[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Sockets remain unclosed
From: |
Ito Kazumitsu |
Subject: |
Sockets remain unclosed |
Date: |
Sat, 17 Apr 2004 09:40:41 +0900 |
User-agent: |
EMH/1.10.0 SEMI/1.13.7 (Awazu) FLIM/1.13.2 (Kasanui) Emacs/21.2 (i386-unknown-freebsd4.7) MULE/5.0 (SAKAKI) |
Hi,
As discussed in the Kaffe mailing list[1], in some cases,
GNU Classpath's java.net.Socket creates sockets which will
never be closed.
[1] http://www.kaffe.org/pipermail/kaffe/2004-April/045856.html
http://www.kaffe.org/pipermail/kaffe/2004-April/045866.html
And here is a patch:
ChangeLog entry:
2004-04-16 Helmer Kraemer <address@hidden>
* libraries/javalib/java/net/Socket.java
getImpl(): Avoid creating a redundant file descriptor.
--- java/net/Socket.java.orig Sat Apr 17 08:54:56 2004
+++ java/net/Socket.java Sat Apr 17 09:26:28 2004
@@ -81,12 +81,6 @@
private SocketImpl impl;
/**
- * True if socket implementation was created by calling their
- * create() method.
- */
- private boolean implCreated;
-
- /**
* True if the socket is bound.
*/
private boolean bound;
@@ -312,19 +306,6 @@
// This has to be accessible from java.net.ServerSocket.
SocketImpl getImpl() throws SocketException
{
- try
- {
- if (! implCreated)
- {
- impl.create(true);
- implCreated = true;
- }
- }
- catch (IOException e)
- {
- throw new SocketException(e.getMessage());
- }
-
return impl;
}
@@ -358,6 +339,7 @@
// bind to address/port
try
{
+ getImpl().create(true);
getImpl().bind(tmp.getAddress(), tmp.getPort());
bound = true;
}
- Sockets remain unclosed,
Ito Kazumitsu <=