summaryrefslogtreecommitdiff
path: root/gnu/java/nio/SocketChannelImpl.java
diff options
context:
space:
mode:
authorMichael Koch <konqueror@gmx.de>2004-11-21 20:23:33 +0000
committerMichael Koch <konqueror@gmx.de>2004-11-21 20:23:33 +0000
commit3e89b72903574b6e0fe0676ea890c1932b586596 (patch)
treeeba9e54f1868227c5e9d7cff0406677a8e084cec /gnu/java/nio/SocketChannelImpl.java
parentd722704ef9fc84bde898c19c37dc6430f800aac8 (diff)
downloadclasspath-3e89b72903574b6e0fe0676ea890c1932b586596.tar.gz
2004-11-21 Michael Koch <konqueror@gmx.de>
* 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.
Diffstat (limited to 'gnu/java/nio/SocketChannelImpl.java')
-rw-r--r--gnu/java/nio/SocketChannelImpl.java6
1 files changed, 3 insertions, 3 deletions
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)