From 3e89b72903574b6e0fe0676ea890c1932b586596 Mon Sep 17 00:00:00 2001 From: Michael Koch Date: Sun, 21 Nov 2004 20:23:33 +0000 Subject: 2004-11-21 Michael Koch * gnu/java/nio/SocketChannelImpl.java (read): Only return 0 when no bytes for reading available in non-blocking mode. * java/nio/channels/SocketChannel.java: Added some missing @return tags. --- gnu/java/nio/SocketChannelImpl.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gnu/java/nio/SocketChannelImpl.java') diff --git a/gnu/java/nio/SocketChannelImpl.java b/gnu/java/nio/SocketChannelImpl.java index c67b7cb7b..23db89226 100644 --- a/gnu/java/nio/SocketChannelImpl.java +++ b/gnu/java/nio/SocketChannelImpl.java @@ -182,7 +182,7 @@ public final class SocketChannelImpl extends SocketChannel // FIXME: Handle blocking/non-blocking mode. Selector selector = provider().openSelector(); - register (selector, SelectionKey.OP_CONNECT); + register(selector, SelectionKey.OP_CONNECT); if (isBlocking()) { @@ -216,7 +216,7 @@ public final class SocketChannelImpl extends SocketChannel return socket; } - public int read (ByteBuffer dst) throws IOException + public int read(ByteBuffer dst) throws IOException { if (!isConnected()) throw new NotYetConnectedException(); @@ -227,7 +227,7 @@ public final class SocketChannelImpl extends SocketChannel int available = input.available(); int len = dst.capacity() - dst.position(); - if (available == 0) + if (! isBlocking() && available == 0) return 0; if (len > available) -- cgit v1.2.1