summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2011-11-08 07:01:49 -0800
committerLance Stout <lancestout@gmail.com>2011-11-08 19:23:53 -0800
commitb8efcc7cf0f4545bd7072b4c495f4d0031c511eb (patch)
treea168888a69b14264a2d5177b3fb8c1851376ee4c
parent2f29d18e535eae03639a709cfe2cd5703a3dd803 (diff)
downloadslixmpp-b8efcc7cf0f4545bd7072b4c495f4d0031c511eb.tar.gz
slixmpp-b8efcc7cf0f4545bd7072b4c495f4d0031c511eb.tar.bz2
slixmpp-b8efcc7cf0f4545bd7072b4c495f4d0031c511eb.tar.xz
slixmpp-b8efcc7cf0f4545bd7072b4c495f4d0031c511eb.zip
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.
-rw-r--r--sleekxmpp/xmlstream/xmlstream.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/sleekxmpp/xmlstream/xmlstream.py b/sleekxmpp/xmlstream/xmlstream.py
index c9b85bd8..aa7fd061 100644
--- a/sleekxmpp/xmlstream/xmlstream.py
+++ b/sleekxmpp/xmlstream/xmlstream.py
@@ -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):
"""