race condition where we were transitioning to 'disconnected' and immediately reconnecting in another thread before the socket.close call occurred. Now we're locking the state machine until the disconnect routine completes.
This commit is contained in:
@@ -302,7 +302,8 @@ class XMLStream(object):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def disconnect(self, reconnect=False):
|
def disconnect(self, reconnect=False):
|
||||||
if not self.state.transition('connected','disconnected'):
|
with self.state.transition_ctx('connected','disconnected') as locked:
|
||||||
|
if not locked:
|
||||||
logging.warning("Already disconnected.")
|
logging.warning("Already disconnected.")
|
||||||
return
|
return
|
||||||
logging.debug("Disconnecting...")
|
logging.debug("Disconnecting...")
|
||||||
|
Reference in New Issue
Block a user