Upgrade quiche to version 0.22.0 (#11995)
upgrade quiche to version 0.22.0 Signed-off-by: Ludovic Orban <lorban@bitronix.be>
This commit is contained in:
parent
f199dae6ab
commit
78e605ac40
|
@ -853,20 +853,21 @@ public class ForeignQuicheConnection extends QuicheConnection
|
|||
throw new IOException("connection was released");
|
||||
|
||||
long written;
|
||||
try (Arena scope = Arena.ofConfined())
|
||||
{
|
||||
MemorySegment outErrorCode = scope.allocate(NativeHelper.C_LONG);
|
||||
if (buffer.isDirect())
|
||||
{
|
||||
// If the ByteBuffer is direct, it can be used without any copy.
|
||||
MemorySegment bufferSegment = MemorySegment.ofBuffer(buffer);
|
||||
written = quiche_h.quiche_conn_stream_send(quicheConn, streamId, bufferSegment, buffer.remaining(), last);
|
||||
written = quiche_h.quiche_conn_stream_send(quicheConn, streamId, bufferSegment, buffer.remaining(), last, outErrorCode);
|
||||
}
|
||||
else
|
||||
{
|
||||
// If the ByteBuffer is heap-allocated, it must be copied to native memory.
|
||||
try (Arena scope = Arena.ofConfined())
|
||||
{
|
||||
if (buffer.remaining() == 0)
|
||||
{
|
||||
written = quiche_h.quiche_conn_stream_send(quicheConn, streamId, MemorySegment.NULL, 0, last);
|
||||
written = quiche_h.quiche_conn_stream_send(quicheConn, streamId, MemorySegment.NULL, 0, last, outErrorCode);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -874,7 +875,7 @@ public class ForeignQuicheConnection extends QuicheConnection
|
|||
int prevPosition = buffer.position();
|
||||
bufferSegment.asByteBuffer().put(buffer);
|
||||
buffer.position(prevPosition);
|
||||
written = quiche_h.quiche_conn_stream_send(quicheConn, streamId, bufferSegment, buffer.remaining(), last);
|
||||
written = quiche_h.quiche_conn_stream_send(quicheConn, streamId, bufferSegment, buffer.remaining(), last, outErrorCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -904,21 +905,19 @@ public class ForeignQuicheConnection extends QuicheConnection
|
|||
long read;
|
||||
try (Arena scope = Arena.ofConfined())
|
||||
{
|
||||
MemorySegment fin = scope.allocate(NativeHelper.C_CHAR);
|
||||
MemorySegment outErrorCode = scope.allocate(NativeHelper.C_LONG);
|
||||
if (buffer.isDirect())
|
||||
{
|
||||
// If the ByteBuffer is direct, it can be used without any copy.
|
||||
MemorySegment bufferSegment = MemorySegment.ofBuffer(buffer);
|
||||
MemorySegment fin = scope.allocate(NativeHelper.C_CHAR);
|
||||
read = quiche_h.quiche_conn_stream_recv(quicheConn, streamId, bufferSegment, buffer.remaining(), fin);
|
||||
read = quiche_h.quiche_conn_stream_recv(quicheConn, streamId, bufferSegment, buffer.remaining(), fin, outErrorCode);
|
||||
}
|
||||
else
|
||||
{
|
||||
// If the ByteBuffer is heap-allocated, native memory must be copied to it.
|
||||
MemorySegment bufferSegment = scope.allocate(buffer.remaining());
|
||||
|
||||
MemorySegment fin = scope.allocate(NativeHelper.C_CHAR);
|
||||
read = quiche_h.quiche_conn_stream_recv(quicheConn, streamId, bufferSegment, buffer.remaining(), fin);
|
||||
|
||||
read = quiche_h.quiche_conn_stream_recv(quicheConn, streamId, bufferSegment, buffer.remaining(), fin, outErrorCode);
|
||||
if (read > 0)
|
||||
{
|
||||
int prevPosition = buffer.position();
|
||||
|
|
|
@ -30,7 +30,7 @@ import static org.eclipse.jetty.quic.quiche.foreign.NativeHelper.C_POINTER;
|
|||
|
||||
public class quiche_h
|
||||
{
|
||||
private static final String EXPECTED_QUICHE_VERSION = "0.21.0";
|
||||
private static final String EXPECTED_QUICHE_VERSION = "0.22.0";
|
||||
private static final Logger LOG = LoggerFactory.getLogger(quiche_h.class);
|
||||
|
||||
private static class LoggingCallback
|
||||
|
@ -485,6 +485,7 @@ public class quiche_h
|
|||
C_LONG,
|
||||
C_POINTER,
|
||||
C_LONG,
|
||||
C_POINTER,
|
||||
C_POINTER
|
||||
));
|
||||
private static final MethodHandle quiche_conn_stream_send = NativeHelper.downcallHandle(
|
||||
|
@ -495,7 +496,8 @@ public class quiche_h
|
|||
C_LONG,
|
||||
C_POINTER,
|
||||
C_LONG,
|
||||
C_BOOL
|
||||
C_BOOL,
|
||||
C_POINTER
|
||||
));
|
||||
private static final MethodHandle quiche_conn_stream_priority = NativeHelper.downcallHandle(
|
||||
"quiche_conn_stream_priority",
|
||||
|
@ -1662,11 +1664,11 @@ public class quiche_h
|
|||
}
|
||||
}
|
||||
|
||||
public static long quiche_conn_stream_recv(MemorySegment conn, long stream_id, MemorySegment out, long buf_len, MemorySegment fin)
|
||||
public static long quiche_conn_stream_recv(MemorySegment conn, long stream_id, MemorySegment out, long buf_len, MemorySegment fin, MemorySegment out_error_code)
|
||||
{
|
||||
try
|
||||
{
|
||||
return (long)DowncallHandles.quiche_conn_stream_recv.invokeExact(conn, stream_id, out, buf_len, fin);
|
||||
return (long)DowncallHandles.quiche_conn_stream_recv.invokeExact(conn, stream_id, out, buf_len, fin, out_error_code);
|
||||
}
|
||||
catch (Throwable x)
|
||||
{
|
||||
|
@ -1674,11 +1676,11 @@ public class quiche_h
|
|||
}
|
||||
}
|
||||
|
||||
public static long quiche_conn_stream_send(MemorySegment conn, long stream_id, MemorySegment buf, long buf_len, boolean fin)
|
||||
public static long quiche_conn_stream_send(MemorySegment conn, long stream_id, MemorySegment buf, long buf_len, boolean fin, MemorySegment out_error_code)
|
||||
{
|
||||
try
|
||||
{
|
||||
return (long)DowncallHandles.quiche_conn_stream_send.invokeExact(conn, stream_id, buf, buf_len, fin);
|
||||
return (long)DowncallHandles.quiche_conn_stream_send.invokeExact(conn, stream_id, buf, buf_len, fin, out_error_code);
|
||||
}
|
||||
catch (Throwable x)
|
||||
{
|
||||
|
|
|
@ -693,7 +693,8 @@ public class JnaQuicheConnection extends QuicheConnection
|
|||
{
|
||||
if (quicheConn == null)
|
||||
throw new IOException("connection was released");
|
||||
int written = LibQuiche.INSTANCE.quiche_conn_stream_send(quicheConn, new uint64_t(streamId), jnaBuffer(buffer), new size_t(buffer.remaining()), last).intValue();
|
||||
uint64_t_pointer outErrorCode = new uint64_t_pointer();
|
||||
int written = LibQuiche.INSTANCE.quiche_conn_stream_send(quicheConn, new uint64_t(streamId), jnaBuffer(buffer), new size_t(buffer.remaining()), last, outErrorCode).intValue();
|
||||
if (written == quiche_error.QUICHE_ERR_DONE)
|
||||
{
|
||||
int rc = LibQuiche.INSTANCE.quiche_conn_stream_writable(quicheConn, new uint64_t(streamId), new size_t(buffer.remaining()));
|
||||
|
@ -745,7 +746,8 @@ public class JnaQuicheConnection extends QuicheConnection
|
|||
if (quicheConn == null)
|
||||
throw new IOException("connection was released");
|
||||
bool_pointer fin = new bool_pointer();
|
||||
int read = LibQuiche.INSTANCE.quiche_conn_stream_recv(quicheConn, new uint64_t(streamId), buffer, new size_t(buffer.remaining()), fin).intValue();
|
||||
uint64_t_pointer outErrorCode = new uint64_t_pointer();
|
||||
int read = LibQuiche.INSTANCE.quiche_conn_stream_recv(quicheConn, new uint64_t(streamId), buffer, new size_t(buffer.remaining()), fin, outErrorCode).intValue();
|
||||
if (read == quiche_error.QUICHE_ERR_DONE)
|
||||
return isStreamFinished(streamId) ? -1 : 0;
|
||||
if (read == quiche_error.QUICHE_ERR_STREAM_RESET)
|
||||
|
|
|
@ -31,7 +31,7 @@ public interface LibQuiche extends Library
|
|||
{
|
||||
// This interface is a translation of the quiche.h header of a specific version.
|
||||
// It needs to be reviewed each time the native lib version changes.
|
||||
String EXPECTED_QUICHE_VERSION = "0.21.0";
|
||||
String EXPECTED_QUICHE_VERSION = "0.22.0";
|
||||
|
||||
// The charset used to convert java.lang.String to char * and vice versa.
|
||||
Charset CHARSET = StandardCharsets.UTF_8;
|
||||
|
@ -540,10 +540,18 @@ public interface LibQuiche extends Library
|
|||
void quiche_stream_iter_free(quiche_stream_iter iter);
|
||||
|
||||
// Reads contiguous data from a stream.
|
||||
ssize_t quiche_conn_stream_recv(quiche_conn conn, uint64_t stream_id, ByteBuffer out, size_t buf_len, bool_pointer fin);
|
||||
// out_error_code is only set when STREAM_STOPPED or STREAM_RESET are returned.
|
||||
// Set to the reported error code associated with STOP_SENDING or STREAM_RESET.
|
||||
ssize_t quiche_conn_stream_recv(quiche_conn conn, uint64_t stream_id,
|
||||
ByteBuffer out, size_t buf_len, bool_pointer fin,
|
||||
uint64_t_pointer out_error_code);
|
||||
|
||||
// Writes data to a stream.
|
||||
ssize_t quiche_conn_stream_send(quiche_conn conn, uint64_t stream_id, ByteBuffer buf, size_t buf_len, boolean fin);
|
||||
// out_error_code is only set when STREAM_STOPPED or STREAM_RESET are returned.
|
||||
// Set to the reported error code associated with STOP_SENDING or STREAM_RESET.
|
||||
ssize_t quiche_conn_stream_send(quiche_conn conn, uint64_t stream_id,
|
||||
ByteBuffer buf, size_t buf_len, boolean fin,
|
||||
uint64_t_pointer out_error_code);
|
||||
|
||||
// Frees the connection object.
|
||||
void quiche_conn_free(quiche_conn conn);
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -214,7 +214,7 @@
|
|||
<jboss.logging.processor.version>2.2.1.Final</jboss.logging.processor.version>
|
||||
<jboss.logging.version>3.5.3.Final</jboss.logging.version>
|
||||
<jetty-assembly-descriptors.version>1.1</jetty-assembly-descriptors.version>
|
||||
<jetty-quiche-native.version>0.21.0</jetty-quiche-native.version>
|
||||
<jetty-quiche-native.version>0.22.0</jetty-quiche-native.version>
|
||||
<jetty-test-policy.version>1.2</jetty-test-policy.version>
|
||||
<jetty-version.maven.plugin.version>2.7</jetty-version.maven.plugin.version>
|
||||
<jetty.perf-helper.version>1.0.7</jetty.perf-helper.version>
|
||||
|
|
Loading…
Reference in New Issue