[Twisted-Python] socket is not closed when connection failed
Yun Mao
maoy at cis.upenn.edu
Wed Feb 16 14:29:23 MST 2005
Here is a quick patch to twisted/internet/tcp.py that seems to fix it.
internet# diff tcp.py tcp_old.py
360,366d359
< # patched by maoy for cleaning resources when connectionFailed########
< if hasattr(self, "socket"):
< if self.socket: self.socket.close()
< del self.socket
< if hasattr(self, "fileno"):
< del self.fileno
< #end patch#########
Yun
On Wed, 16 Feb 2005, Yun Mao wrote:
> Hi everyone,
>
> I found that if a TCP connection is failed, e.g. UserTimeout or No route to
> host, connection refused, etc, i.e. when factory.ConnectionFailed is called,
> the socket is not properly cleaned up. i.e. socket.close() wasn't called. In
> this case, when I try to connect to many unreachable hosts, my file
> descriptor will finally be gone.
>
> Could someone confirm me on this? Thanks. I'm using twisted 1.3.0rc1
>
> Yun
>
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
More information about the Twisted-Python
mailing list