OSDN Git Service

2003-12-02 Michael Koch <konqueror@gmx.de>
authormkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 2 Dec 2003 15:23:23 +0000 (15:23 +0000)
committermkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 2 Dec 2003 15:23:23 +0000 (15:23 +0000)
* 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@74183 138bc75d-0d04-0410-961f-82ee72b054a4

libjava/ChangeLog
libjava/java/net/DatagramSocket.java
libjava/java/net/ServerSocket.java
libjava/java/net/Socket.java

index 409bf3b..82873fe 100644 (file)
@@ -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.
index f4bc4ea..e3edfcd 100644 (file)
@@ -232,6 +232,16 @@ public class DatagramSocket
            remotePort = -1;
            impl = null;
          }
+
+       try
+         {
+           if (getChannel() != null)
+             getChannel().close();
+         }
+       catch (IOException e)
+         {
+           // Do nothing.
+         }
       }
   }
 
index 7af1a33..4e7f58a 100644 (file)
@@ -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()
            + "]");
index 27fa691..a0f831c 100644 (file)
@@ -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;
   }
 
   /**