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

This commit is contained in:
Eric Scharff 2007-10-07 11:35:48 -06:00
parent 35a96a0d36
commit 9368dd2acc

View File

@ -58,7 +58,9 @@ public class SocketChannel extends SelectableChannel
natThrowWriteError(socket);
}
int w = natWrite(socket, b.array(), b.arrayOffset() + b.position(), b.remaining());
b.position(b.position() + w);
if (w > 0) {
b.position(b.position() + w);
}
return w;
}