Continue trying to reconnect, even if the attempt fails.

The transition from disconnected to connected states must be done in a
loop in case the transition fails, not just once and hope it worked.
This commit is contained in:
Lance Stout 2011-11-07 01:13:34 -08:00
parent 1a93a187f0
commit 888e286a09

View file

@ -530,12 +530,8 @@ class XMLStream(object):
""" """
Reset the stream's state and reconnect to the server. Reset the stream's state and reconnect to the server.
""" """
log.debug("reconnecting...") self.disconnect()
self.state.transition('connected', 'disconnected', wait=2.0, self.connect()
func=self._disconnect, args=(True,))
log.debug("connecting...")
return self.state.transition('disconnected', 'connected',
wait=2.0, func=self._connect)
def set_socket(self, socket, ignore=False): def set_socket(self, socket, ignore=False):
""" """