Permalink
Browse files

Fix for Transport.__del__ for late threads at shutdown. Closes #36

  • Loading branch information...
1 parent b781f9c commit 78f9b9b58b64aa1294154e9046ec26f21d9f4cca @ask ask committed Mar 5, 2014
Showing with 7 additions and 3 deletions.
  1. +7 −3 amqp/transport.py
View
@@ -109,9 +109,13 @@ def __init__(self, host, connect_timeout):
def __del__(self):
try:
- self.close()
- except socket.error:
- pass
+ # socket module may have been collected by gc
+ # if this is called by a thread at shutdown.
+ if socket is not None:
+ try:
+ self.close()
+ except socket.error:
+ pass
finally:
self.sock = None

0 comments on commit 78f9b9b

Please sign in to comment.