diff options
author | green <green@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-12-28 17:46:21 +0000 |
---|---|---|
committer | green <green@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-12-28 17:46:21 +0000 |
commit | e175334c900392e2c65a5ce36dea8247f46f855f (patch) | |
tree | 15dd1635f8c865e018064a4aa8d7cfaa79c78f5e /libjava | |
parent | 328eb802880e7a7d81d9a413aa73a88f2b6eed60 (diff) | |
download | gcc-e175334c900392e2c65a5ce36dea8247f46f855f.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@109114 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava')
-rw-r--r-- | libjava/classpath/ChangeLog | 16 | ||||
-rw-r--r-- | libjava/classpath/gnu/java/nio/DatagramChannelImpl.java | 2 | ||||
-rw-r--r-- | libjava/classpath/gnu/java/nio/SelectorImpl.java | 26 | ||||
-rw-r--r-- | libjava/classpath/gnu/java/nio/SocketChannelImpl.java | 2 | ||||
-rw-r--r-- | libjava/classpath/java/net/Socket.java | 20 |
5 files changed, 32 insertions, 34 deletions
diff --git a/libjava/classpath/ChangeLog b/libjava/classpath/ChangeLog index 125388f5d6f..85df787cc4d 100644 --- a/libjava/classpath/ChangeLog +++ b/libjava/classpath/ChangeLog @@ -1,3 +1,19 @@ +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> * javax/swing/JEditorPane.java diff --git a/libjava/classpath/gnu/java/nio/DatagramChannelImpl.java b/libjava/classpath/gnu/java/nio/DatagramChannelImpl.java index 51c7031fe69..4687bf3f59e 100644 --- a/libjava/classpath/gnu/java/nio/DatagramChannelImpl.java +++ b/libjava/classpath/gnu/java/nio/DatagramChannelImpl.java @@ -201,7 +201,7 @@ public final class DatagramChannelImpl extends DatagramChannel try { DatagramPacket packet; - int len = dst.capacity() - dst.position(); + int len = dst.remaining(); if (dst.hasArray()) { diff --git a/libjava/classpath/gnu/java/nio/SelectorImpl.java b/libjava/classpath/gnu/java/nio/SelectorImpl.java index dcafedeb8bb..e10f7157443 100644 --- a/libjava/classpath/gnu/java/nio/SelectorImpl.java +++ b/libjava/classpath/gnu/java/nio/SelectorImpl.java @@ -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. diff --git a/libjava/classpath/gnu/java/nio/SocketChannelImpl.java b/libjava/classpath/gnu/java/nio/SocketChannelImpl.java index fcddbd6c351..680eba2f92b 100644 --- a/libjava/classpath/gnu/java/nio/SocketChannelImpl.java +++ b/libjava/classpath/gnu/java/nio/SocketChannelImpl.java @@ -220,7 +220,7 @@ public final class SocketChannelImpl extends SocketChannel int offset = 0; InputStream input = socket.getInputStream(); int available = input.available(); - int len = dst.capacity() - dst.position(); + int len = dst.remaining(); if ((! isBlocking()) && available == 0) return 0; diff --git a/libjava/classpath/java/net/Socket.java b/libjava/classpath/java/net/Socket.java index 0ff6e6ea032..b2249ffaa0d 100644 --- a/libjava/classpath/java/net/Socket.java +++ b/libjava/classpath/java/net/Socket.java @@ -437,25 +437,7 @@ public class Socket if (! isBound()) bind(null); - try - { - getImpl().connect(endpoint, timeout); - } - catch (IOException exception) - { - close(); - throw exception; - } - catch (RuntimeException exception) - { - close(); - throw exception; - } - catch (Error error) - { - close(); - throw error; - } + getImpl().connect(endpoint, timeout); } /** |