From 8696d927c03a0551bfdc7ab8acc756d31d468592 Mon Sep 17 00:00:00 2001 From: Mohan Embar Date: Tue, 3 Feb 2004 16:07:24 +0000 Subject: * gnu/java/nio/DatagramChannelImpl.java (inChannelOperation): New field. (isInChannelOperation): New accessor. (setInChannelOperation): New modifier. (receive): Use capacity() - position() of destination buffer instead of remaining(). Set and reset our "in channel operation indicator" before and after delegating the receive to our datagram socket. Removed testing code. Update destination buffer's current position if it is backed by a byte array (hasArray() is true). (send): Set and reset our "in channel operation indicator" before and after delegating the send to our datagram socket. Removed testing code. Update source buffer's current position if it is backed by a byte array (hasArray() is true). * gnu/java/nio/SocketChannelImpl.java (read(ByteBuffer)): Use capacity() - position() of destination buffer instead of remaining(). * java/net/DatagramSocket.java (receive): Don't throw an IllegalBlockingModeException if we have a non-blocking channel which initiated this operation. (send): Likewise. From-SVN: r77173 --- libjava/java/net/DatagramSocket.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'libjava/java') diff --git a/libjava/java/net/DatagramSocket.java b/libjava/java/net/DatagramSocket.java index c9c0f5d..c5920a0 100644 --- a/libjava/java/net/DatagramSocket.java +++ b/libjava/java/net/DatagramSocket.java @@ -39,6 +39,7 @@ exception statement from your version. */ package java.net; import gnu.java.net.PlainDatagramSocketImpl; +import gnu.java.nio.DatagramChannelImpl; import java.io.IOException; import java.nio.channels.DatagramChannel; import java.nio.channels.IllegalBlockingModeException; @@ -565,7 +566,8 @@ public class DatagramSocket ("Socket connected to a multicast address my not receive"); if (getChannel() != null - && !getChannel().isBlocking ()) + && !getChannel().isBlocking () + && !((DatagramChannelImpl) getChannel()).isInChannelOperation()) throw new IllegalBlockingModeException (); getImpl().receive(p); @@ -618,7 +620,8 @@ public class DatagramSocket // use getTimeToLive for TTL val. if (getChannel() != null - && !getChannel().isBlocking ()) + && !getChannel().isBlocking () + && !((DatagramChannelImpl) getChannel()).isInChannelOperation()) throw new IllegalBlockingModeException (); getImpl().send(p); -- cgit v1.1