Commit c531dd01 by Michael Koch Committed by Michael Koch

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.

From-SVN: r74183
parent d9b526cc
2003-12-02 Michael Koch <konqueror@gmx.de> 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 * java/nio/channels/spi/AbstractInterruptibleChannel.java
(opened): Removed. (opened): Removed.
(closed): New field. (closed): New field.
......
...@@ -232,6 +232,16 @@ public class DatagramSocket ...@@ -232,6 +232,16 @@ public class DatagramSocket
remotePort = -1; remotePort = -1;
impl = null; impl = null;
} }
try
{
if (getChannel() != null)
getChannel().close();
}
catch (IOException e)
{
// Do nothing.
}
} }
} }
......
...@@ -356,12 +356,11 @@ public class ServerSocket ...@@ -356,12 +356,11 @@ public class ServerSocket
if (!isClosed()) if (!isClosed())
{ {
impl.close(); impl.close();
impl = null;
bound = false;
if (getChannel() != null) if (getChannel() != null)
getChannel().close(); getChannel().close();
impl = null;
bound = false;
} }
} }
...@@ -543,7 +542,7 @@ public class ServerSocket ...@@ -543,7 +542,7 @@ public class ServerSocket
if (!isBound()) if (!isBound())
return "ServerSocket[unbound]"; return "ServerSocket[unbound]";
return ("ServerSocket[addr=" + impl.getInetAddress() return ("ServerSocket[addr=" + getInetAddress()
+ ",port=" + impl.getPort() + ",port=" + impl.getPort()
+ ",localport=" + impl.getLocalPort() + ",localport=" + impl.getLocalPort()
+ "]"); + "]");
......
...@@ -1006,12 +1006,11 @@ public class Socket ...@@ -1006,12 +1006,11 @@ public class Socket
throw new SocketException("socket is closed"); throw new SocketException("socket is closed");
getImpl().close(); getImpl().close();
impl = null;
bound = false;
if (getChannel() != null) if (getChannel() != null)
getChannel().close(); getChannel().close();
impl = null;
bound = false;
} }
/** /**
......
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