diff options
-rw-r--r-- | libjava/ChangeLog | 9 | ||||
-rw-r--r-- | libjava/java/net/DatagramSocket.java | 10 | ||||
-rw-r--r-- | libjava/java/net/ServerSocket.java | 7 | ||||
-rw-r--r-- | libjava/java/net/Socket.java | 5 |
4 files changed, 24 insertions, 7 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 409bf3b..82873fe 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,5 +1,14 @@ 2003-12-02 Michael Koch <konqueror@gmx.de> + * java/net/DatagramSocket.java + (close): Close associated DatagramChannel object. + * java/net/ServerSocket.java + * java/net/Socket.java + (close): Reset impl and bound before calling getChannel().close() to + prevent from loops. + +2003-12-02 Michael Koch <konqueror@gmx.de> + * java/nio/channels/spi/AbstractInterruptibleChannel.java (opened): Removed. (closed): New field. diff --git a/libjava/java/net/DatagramSocket.java b/libjava/java/net/DatagramSocket.java index f4bc4ea..e3edfcd 100644 --- a/libjava/java/net/DatagramSocket.java +++ b/libjava/java/net/DatagramSocket.java @@ -232,6 +232,16 @@ public class DatagramSocket remotePort = -1; impl = null; } + + try + { + if (getChannel() != null) + getChannel().close(); + } + catch (IOException e) + { + // Do nothing. + } } } diff --git a/libjava/java/net/ServerSocket.java b/libjava/java/net/ServerSocket.java index 7af1a33..4e7f58a 100644 --- a/libjava/java/net/ServerSocket.java +++ b/libjava/java/net/ServerSocket.java @@ -356,12 +356,11 @@ public class ServerSocket if (!isClosed()) { impl.close(); + impl = null; + bound = false; if (getChannel() != null) getChannel().close(); - - impl = null; - bound = false; } } @@ -543,7 +542,7 @@ public class ServerSocket if (!isBound()) return "ServerSocket[unbound]"; - return ("ServerSocket[addr=" + impl.getInetAddress() + return ("ServerSocket[addr=" + getInetAddress() + ",port=" + impl.getPort() + ",localport=" + impl.getLocalPort() + "]"); diff --git a/libjava/java/net/Socket.java b/libjava/java/net/Socket.java index 27fa691..a0f831c 100644 --- a/libjava/java/net/Socket.java +++ b/libjava/java/net/Socket.java @@ -1006,12 +1006,11 @@ public class Socket throw new SocketException("socket is closed"); getImpl().close(); + impl = null; + bound = false; if (getChannel() != null) getChannel().close(); - - impl = null; - bound = false; } /** |