[multiple changes]

2005-12-27  Tom Tromey  <tromey@redhat.com>

	* gnu/java/nio/SelectorImpl.java: Added import.

2005-12-26  Anthony Green  <green@redhat.com>

        * java/net/Socket.java (connect): Don't close the socket on
        exceptions.

        * gnu/java/nio/SocketChannelImpl.java (read): Compute the right amount
        of data to read (dst.remaining()).
        * gnu/java/nio/DatagramChannelImpl.java (receive): Ditto.

        * gnu/java/nio/SelectorImpl.java (select): Handle OP_CONNECT
        properly.

From-SVN: r109114
This commit is contained in:
Anthony Green 2005-12-28 17:46:21 +00:00
parent 3779973b0b
commit 5c3bb9eb9e
5 changed files with 32 additions and 34 deletions

View file

@ -43,6 +43,7 @@ import java.nio.channels.ClosedSelectorException;
import java.nio.channels.SelectableChannel;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.nio.channels.SocketChannel;
import java.nio.channels.spi.AbstractSelectableChannel;
import java.nio.channels.spi.AbstractSelector;
import java.nio.channels.spi.SelectorProvider;
@ -284,19 +285,18 @@ public class SelectorImpl extends AbstractSelector
// Set new ready write ops
for (int i = 0; i < write.length; i++)
{
if (key.getNativeFD() == write[i])
{
ops = ops | SelectionKey.OP_WRITE;
// if (key.channel ().isConnected ())
// {
// ops = ops | SelectionKey.OP_WRITE;
// }
// else
// {
// ops = ops | SelectionKey.OP_CONNECT;
// }
}
if (key.getNativeFD() == write[i])
{
if (key.channel() instanceof SocketChannel)
{
if (((SocketChannel) key.channel ()).isConnected ())
ops = ops | SelectionKey.OP_WRITE;
else
ops = ops | SelectionKey.OP_CONNECT;
}
else
ops = ops | SelectionKey.OP_WRITE;
}
}
// FIXME: We dont handle exceptional file descriptors yet.