Don't just call self.disconnect in self.reconnect.

It messes up the auto_reconnect value and causes the XML processing
loop to spin wildly with errors on a stream disconnect.
This commit is contained in:
Lance Stout 2011-11-08 07:01:49 -08:00
parent 2f29d18e53
commit b8efcc7cf0

View file

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