Fix an off-by-one error when EOS is hit on the socket

This commit is contained in:
Eric Scharff 2007-10-07 09:53:07 -06:00
parent 19b6e11cbc
commit 35a96a0d36

View File

@ -47,7 +47,9 @@ public class SocketChannel extends SelectableChannel
if (! open) return -1;
if (b.remaining() == 0) return 0;
int r = natRead(socket, b.array(), b.arrayOffset() + b.position(), b.remaining());
b.position(b.position() + r);
if (r > 0) {
b.position(b.position() + r);
}
return r;
}