Commit 4268a9b5 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Catch socket exception around fileno() to not crash if the socket is already

closed (invalid descriptor found).


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@818 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 170f6f41
......@@ -132,8 +132,12 @@ class SocketConnector:
return self.socket.close()
def __repr__(self):
result = '<%s at 0x%x fileno %i %s ' % (self.__class__.__name__, id(self),
self.socket.fileno(), self.socket.getsockname())
try:
fileno = str(self.socket.fileno())
except socket.error, (err, errmsg):
fileno = '?'
result = '<%s at 0x%x fileno %s %s>' % (self.__class__.__name__, id(self),
fileno, self.socket.getsockname())
if self.is_closed is None:
result += 'never opened'
else:
......
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