Commit 5c3bb9eb by Anthony Green

[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
parent 3779973b
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.
2005-11-17 Roman Kennke <kennke@aicas.com> 2005-11-17 Roman Kennke <kennke@aicas.com>
* javax/swing/JEditorPane.java * javax/swing/JEditorPane.java
...@@ -201,7 +201,7 @@ public final class DatagramChannelImpl extends DatagramChannel ...@@ -201,7 +201,7 @@ public final class DatagramChannelImpl extends DatagramChannel
try try
{ {
DatagramPacket packet; DatagramPacket packet;
int len = dst.capacity() - dst.position(); int len = dst.remaining();
if (dst.hasArray()) if (dst.hasArray())
{ {
......
...@@ -43,6 +43,7 @@ import java.nio.channels.ClosedSelectorException; ...@@ -43,6 +43,7 @@ import java.nio.channels.ClosedSelectorException;
import java.nio.channels.SelectableChannel; import java.nio.channels.SelectableChannel;
import java.nio.channels.SelectionKey; import java.nio.channels.SelectionKey;
import java.nio.channels.Selector; import java.nio.channels.Selector;
import java.nio.channels.SocketChannel;
import java.nio.channels.spi.AbstractSelectableChannel; import java.nio.channels.spi.AbstractSelectableChannel;
import java.nio.channels.spi.AbstractSelector; import java.nio.channels.spi.AbstractSelector;
import java.nio.channels.spi.SelectorProvider; import java.nio.channels.spi.SelectorProvider;
...@@ -284,19 +285,18 @@ public class SelectorImpl extends AbstractSelector ...@@ -284,19 +285,18 @@ public class SelectorImpl extends AbstractSelector
// Set new ready write ops // Set new ready write ops
for (int i = 0; i < write.length; i++) for (int i = 0; i < write.length; i++)
{ {
if (key.getNativeFD() == write[i]) if (key.getNativeFD() == write[i])
{ {
ops = ops | SelectionKey.OP_WRITE; if (key.channel() instanceof SocketChannel)
{
// if (key.channel ().isConnected ()) if (((SocketChannel) key.channel ()).isConnected ())
// { ops = ops | SelectionKey.OP_WRITE;
// ops = ops | SelectionKey.OP_WRITE; else
// } ops = ops | SelectionKey.OP_CONNECT;
// else }
// { else
// ops = ops | SelectionKey.OP_CONNECT; ops = ops | SelectionKey.OP_WRITE;
// } }
}
} }
// FIXME: We dont handle exceptional file descriptors yet. // FIXME: We dont handle exceptional file descriptors yet.
......
...@@ -220,7 +220,7 @@ public final class SocketChannelImpl extends SocketChannel ...@@ -220,7 +220,7 @@ public final class SocketChannelImpl extends SocketChannel
int offset = 0; int offset = 0;
InputStream input = socket.getInputStream(); InputStream input = socket.getInputStream();
int available = input.available(); int available = input.available();
int len = dst.capacity() - dst.position(); int len = dst.remaining();
if ((! isBlocking()) && available == 0) if ((! isBlocking()) && available == 0)
return 0; return 0;
......
...@@ -437,25 +437,7 @@ public class Socket ...@@ -437,25 +437,7 @@ public class Socket
if (! isBound()) if (! isBound())
bind(null); bind(null);
try getImpl().connect(endpoint, timeout);
{
getImpl().connect(endpoint, timeout);
}
catch (IOException exception)
{
close();
throw exception;
}
catch (RuntimeException exception)
{
close();
throw exception;
}
catch (Error error)
{
close();
throw error;
}
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment