From 7dcc98e25c7da0f7eeef93d77d0ead2e5814b019 Mon Sep 17 00:00:00 2001 From: Mohan Embar Date: Fri, 30 Jan 2004 13:43:21 +0000 Subject: * gnu/java/net/PlainSocketImpl.java (inChannelOperation): New field. (isInChannelOperation): New accessor. (setInChannelOperation): New modifier. * gnu/java/nio/ServerSocketChannelImpl.java (accept): Set and reset our server socket's PlainSocketImpl's "in channel operation" indicator before and after delegating the accept to our server socket. * gnu/java/nio/SocketChannelImpl.java (connect): Set and reset our socket's PlainSocketImpl's "in channel operation" indicator before and after delegating the operation to our socket. (read): Likewise. (write): Likewise. * java/net/ServerSocket.java (implAccept): Don't throw an IllegalBlockingModeException if we have a non-blocking channel which initiated this accept operation. * java/net/Socket.java (connect): Don't throw an IllegalBlockingModeException if we have a non-blocking channel which initiated this connect operation. * java/nio/channels/spi/AbstractSelectableChannel.java (configureBlocking): Only call implConfigureBlocking() if the desired blocking mode is different from our current one. From-SVN: r76956 --- libjava/gnu/java/nio/ServerSocketChannelImpl.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'libjava/gnu/java/nio/ServerSocketChannelImpl.java') diff --git a/libjava/gnu/java/nio/ServerSocketChannelImpl.java b/libjava/gnu/java/nio/ServerSocketChannelImpl.java index fd975d20a7a..76e1ce3242f 100644 --- a/libjava/gnu/java/nio/ServerSocketChannelImpl.java +++ b/libjava/gnu/java/nio/ServerSocketChannelImpl.java @@ -1,5 +1,5 @@ /* ServerSocketChannelImpl.java -- - Copyright (C) 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -69,7 +69,7 @@ public final class ServerSocketChannelImpl extends ServerSocketChannel { return serverSocket.getPlainSocketImpl().getNativeFD(); } - + public void finalizer() { if (connected) @@ -107,6 +107,11 @@ public final class ServerSocketChannelImpl extends ServerSocketChannel try { + begin(); + serverSocket.getPlainSocketImpl().setInChannelOperation(true); + // indicate that a channel is initiating the accept operation + // so that the socket ignores the fact that we might be in + // non-blocking mode. NIOSocket socket = (NIOSocket) serverSocket.accept(); completed = true; return socket.getChannel(); @@ -117,6 +122,7 @@ public final class ServerSocketChannelImpl extends ServerSocketChannel } finally { + serverSocket.getPlainSocketImpl().setInChannelOperation(false); end (completed); } } -- cgit v1.2.3