fix buffer fill/flush modes
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
This commit is contained in:
parent
c2d8688feb
commit
60b660cf04
|
@ -96,7 +96,6 @@ public class QuicConnection extends AbstractConnection
|
|||
try
|
||||
{
|
||||
ByteBuffer cipherBuffer = byteBufferPool.acquire(LibQuiche.QUICHE_MIN_CLIENT_INITIAL_LEN + ServerDatagramEndPoint.ENCODED_ADDRESS_LENGTH, true);
|
||||
BufferUtil.flipToFill(cipherBuffer);
|
||||
while (true)
|
||||
{
|
||||
// Read data
|
||||
|
@ -185,7 +184,7 @@ public class QuicConnection extends AbstractConnection
|
|||
}
|
||||
}
|
||||
}
|
||||
BufferUtil.clearToFill(cipherBuffer);
|
||||
cipherBuffer.clear().flip();
|
||||
}
|
||||
}
|
||||
catch (Throwable x)
|
||||
|
|
|
@ -31,6 +31,7 @@ import org.eclipse.jetty.io.EndPoint;
|
|||
import org.eclipse.jetty.io.FillInterest;
|
||||
import org.eclipse.jetty.io.IdleTimeout;
|
||||
import org.eclipse.jetty.io.ManagedSelector;
|
||||
import org.eclipse.jetty.util.BufferUtil;
|
||||
import org.eclipse.jetty.util.Callback;
|
||||
import org.eclipse.jetty.util.thread.Scheduler;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -122,6 +123,8 @@ public class ServerDatagramEndPoint extends IdleTimeout implements EndPoint, Man
|
|||
@Override
|
||||
public int fill(ByteBuffer buffer) throws IOException
|
||||
{
|
||||
BufferUtil.flipToFill(buffer);
|
||||
|
||||
int headerPosition = buffer.position();
|
||||
buffer.position(buffer.position() + ENCODED_ADDRESS_LENGTH);
|
||||
InetSocketAddress peer = (InetSocketAddress)channel.receive(buffer);
|
||||
|
|
Loading…
Reference in New Issue