todos and cleanups

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
This commit is contained in:
Ludovic Orban 2021-03-29 11:05:49 +02:00 committed by Simone Bordet
parent 197851257e
commit c117fbc61a
4 changed files with 15 additions and 5 deletions

View File

@ -78,6 +78,7 @@ public abstract class QuicConnection extends AbstractConnection
{
try
{
// TODO make the buffer size configurable
ByteBuffer cipherBuffer = byteBufferPool.acquire(LibQuiche.QUICHE_MIN_CLIENT_INITIAL_LEN, true);
while (true)
{

View File

@ -37,6 +37,16 @@ public class QuicDatagramEndPoint extends AbstractEndPoint implements ManagedSel
{
private static final Logger LOG = LoggerFactory.getLogger(QuicDatagramEndPoint.class);
/**
* {@link #fill(ByteBuffer)} needs to pass the {@link InetSocketAddress} together with the buffer
* and {@link #flush(ByteBuffer...)} needs the {@link InetSocketAddress} passed together with the buffer.
* Since we cannot change the {@link org.eclipse.jetty.io.EndPoint} API, the {@link InetSocketAddress}
* argument must be passed on the side with this thread-local.
*
* Note: a first implementation was encoding the InetSocketAddress in the buffer(s) but this was as complex
* and required a mildly expensive encode-decode cycle each time one of those two methods was called.
* This mechanism is as complex and brittle but virtually as cheap as standard argument passing.
*/
public static InetAddressArgument INET_ADDRESS_ARGUMENT = new InetAddressArgument();
private final AutoLock _lock = new AutoLock();
@ -272,11 +282,6 @@ public class QuicDatagramEndPoint extends AbstractEndPoint implements ManagedSel
return flushedAll;
}
public DatagramChannel getChannel()
{
return _channel;
}
@Override
public Object getTransport()
{

View File

@ -297,6 +297,7 @@ public abstract class QuicSession
@Override
protected Action process() throws IOException
{
// TODO make the buffer size configurable
cipherBuffer = byteBufferPool.acquire(LibQuiche.QUICHE_MIN_CLIENT_INITIAL_LEN, true);
int pos = BufferUtil.flipToFill(cipherBuffer);
int drained = quicheConnection.drainCipherText(cipherBuffer);

View File

@ -59,11 +59,14 @@ public class ServerQuicConnection extends QuicConnection
protected QuicSession createSession(InetSocketAddress remoteAddress, ByteBuffer cipherBuffer) throws IOException
{
ByteBufferPool byteBufferPool = getByteBufferPool();
// TODO make the token validator configurable
QuicheConnection quicheConnection = QuicheConnection.tryAccept(quicheConfig, new SimpleTokenValidator(remoteAddress), cipherBuffer);
if (quicheConnection == null)
{
// TODO make the buffer size configurable
ByteBuffer negotiationBuffer = byteBufferPool.acquire(LibQuiche.QUICHE_MIN_CLIENT_INITIAL_LEN, true);
int pos = BufferUtil.flipToFill(negotiationBuffer);
// TODO make the token minter configurable
if (!QuicheConnection.negotiate(new SimpleTokenMinter(remoteAddress), cipherBuffer, negotiationBuffer))
{
if (LOG.isDebugEnabled())