whups, somehow I lost the 'connecting' lock in connect()

This commit is contained in:
Thom Nichols 2010-06-03 08:09:09 -04:00
parent 2f0f18a8c6
commit da6e1e47dc

View File

@ -101,6 +101,10 @@ class XMLStream(object):
def connect(self, host='', port=0, use_ssl=None, use_tls=None): def connect(self, host='', port=0, use_ssl=None, use_tls=None):
"Link to connectTCP" "Link to connectTCP"
if not self.state.transition('disconnected','connecting'):
logging.warning("Can't connect now; Already in state %s", self.state.current_state())
return False
if not self.connectTCP(host, port, use_ssl, use_tls): if not self.connectTCP(host, port, use_ssl, use_tls):
# return to the 'disconnected' state if connect failed: # return to the 'disconnected' state if connect failed:
# otherwise the connect method is not reentrant # otherwise the connect method is not reentrant