mirror of
https://github.com/corda/corda.git
synced 2025-01-17 02:09:50 +00:00
Make sure to report EOF when reading from a socket channel
This commit is contained in:
parent
98269286e5
commit
19b6e11cbc
@ -271,6 +271,8 @@ Java_java_nio_channels_SocketChannel_natRead(JNIEnv *e,
|
||||
} else {
|
||||
throwIOException(e);
|
||||
}
|
||||
} else if (r == 0) {
|
||||
return -1;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
@ -44,6 +44,7 @@ public class SocketChannel extends SelectableChannel
|
||||
}
|
||||
|
||||
public int read(ByteBuffer b) throws IOException {
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user