Added exception handling to destructor in case of connection failure
This commit is contained in:
parent
128552180e
commit
1f8fc10661
4 changed files with 12 additions and 5 deletions
|
|
@ -31,8 +31,11 @@ class SocketIO(object):
|
|||
self.connection = create_connection('ws://%s:%d/socket.io/1/websocket/%s' % (self.host, self.port, self.sessionID))
|
||||
|
||||
def __del__(self):
|
||||
self.heartbeatThread.cancel()
|
||||
self.connection.close()
|
||||
try:
|
||||
self.heartbeatThread.cancel()
|
||||
self.connection.close()
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
def __send_heartbeat(self):
|
||||
self.connection.send('2::')
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue