Merge remote-tracking branch 'origin/jetty-10.0.x' into jetty-11.0.x
This commit is contained in:
commit
0701286722
|
@ -410,7 +410,6 @@ public abstract class QuicSession extends ContainerLifeCycle
|
|||
try
|
||||
{
|
||||
endPoints.clear();
|
||||
flusher.close();
|
||||
getQuicConnection().outwardClose(this, failure);
|
||||
}
|
||||
finally
|
||||
|
@ -455,13 +454,6 @@ public abstract class QuicSession extends ContainerLifeCycle
|
|||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close()
|
||||
{
|
||||
super.close();
|
||||
timeout.destroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Action process() throws IOException
|
||||
{
|
||||
|
@ -514,8 +506,7 @@ public abstract class QuicSession extends ContainerLifeCycle
|
|||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("connection closed {}", QuicSession.this);
|
||||
byteBufferPool.release(cipherBuffer);
|
||||
finishOutwardClose(new ClosedChannelException());
|
||||
finish(new ClosedChannelException());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -523,8 +514,14 @@ public abstract class QuicSession extends ContainerLifeCycle
|
|||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("failed to write cipher bytes, closing session on {}", QuicSession.this, failure);
|
||||
finish(failure);
|
||||
}
|
||||
|
||||
private void finish(Throwable failure)
|
||||
{
|
||||
byteBufferPool.release(cipherBuffer);
|
||||
finishOutwardClose(failure);
|
||||
timeout.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,8 +29,8 @@ import jdk.incubator.foreign.MemoryAddress;
|
|||
import jdk.incubator.foreign.MemorySegment;
|
||||
import jdk.incubator.foreign.ResourceScope;
|
||||
import org.eclipse.jetty.quic.quiche.Quiche;
|
||||
import org.eclipse.jetty.quic.quiche.Quiche.quiche_error;
|
||||
import org.eclipse.jetty.quic.quiche.Quiche.quic_error;
|
||||
import org.eclipse.jetty.quic.quiche.Quiche.quiche_error;
|
||||
import org.eclipse.jetty.quic.quiche.QuicheConfig;
|
||||
import org.eclipse.jetty.quic.quiche.QuicheConnection;
|
||||
import org.eclipse.jetty.util.BufferUtil;
|
||||
|
@ -865,7 +865,12 @@ public class ForeignIncubatorQuicheConnection extends QuicheConnection
|
|||
}
|
||||
|
||||
if (written == quiche_error.QUICHE_ERR_DONE)
|
||||
{
|
||||
int rc = quiche_h.quiche_conn_stream_writable(quicheConn, streamId, buffer.remaining());
|
||||
if (rc < 0)
|
||||
throw new IOException("failed to write to stream " + streamId + "; quiche_err=" + quiche_error.errToString(rc));
|
||||
return 0;
|
||||
}
|
||||
if (written < 0L)
|
||||
throw new IOException("failed to write to stream " + streamId + "; quiche_err=" + quiche_error.errToString(written));
|
||||
buffer.position((int)(buffer.position() + written));
|
||||
|
|
|
@ -310,6 +310,12 @@ public class quiche_h
|
|||
FunctionDescriptor.of(C_LONG, C_POINTER, C_LONG, C_POINTER, C_LONG, C_CHAR)
|
||||
);
|
||||
|
||||
private static final MethodHandle quiche_conn_stream_writable$MH = downcallHandle(
|
||||
"quiche_conn_stream_writable",
|
||||
"(Ljdk/incubator/foreign/MemoryAddress;JJ)I",
|
||||
FunctionDescriptor.of(C_INT, C_POINTER, C_LONG, C_LONG)
|
||||
);
|
||||
|
||||
private static final MethodHandle quiche_conn_stream_recv$MH = downcallHandle(
|
||||
"quiche_conn_stream_recv",
|
||||
"(Ljdk/incubator/foreign/MemoryAddress;JLjdk/incubator/foreign/MemoryAddress;JLjdk/incubator/foreign/MemoryAddress;)J",
|
||||
|
@ -670,6 +676,18 @@ public class quiche_h
|
|||
}
|
||||
}
|
||||
|
||||
public static int quiche_conn_stream_writable(MemoryAddress conn, long stream_id, long buf_len)
|
||||
{
|
||||
try
|
||||
{
|
||||
return (int) quiche_conn_stream_writable$MH.invokeExact(conn, stream_id, buf_len);
|
||||
}
|
||||
catch (Throwable ex)
|
||||
{
|
||||
throw new AssertionError("should not reach here", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public static byte quiche_stream_iter_next(MemoryAddress conn, MemoryAddress stream_id)
|
||||
{
|
||||
try
|
||||
|
|
|
@ -692,7 +692,12 @@ public class JnaQuicheConnection extends QuicheConnection
|
|||
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();
|
||||
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()));
|
||||
if (rc < 0)
|
||||
throw new IOException("failed to write to stream " + streamId + "; quiche_err=" + quiche_error.errToString(rc));
|
||||
return 0;
|
||||
}
|
||||
if (written < 0L)
|
||||
throw new IOException("failed to write to stream " + streamId + "; quiche_err=" + quiche_error.errToString(written));
|
||||
buffer.position(buffer.position() + written);
|
||||
|
|
Loading…
Reference in New Issue