fill now expects a fillable buffer + resets the buffer's position when nothing is read
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
This commit is contained in:
parent
ed49749897
commit
add0c8b605
|
@ -107,13 +107,12 @@ 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);
|
||||
if (peer == null)
|
||||
{
|
||||
buffer.position(0);
|
||||
buffer.position(headerPosition);
|
||||
buffer.flip();
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue