From b8efcc7cf0f4545bd7072b4c495f4d0031c511eb Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Tue, 8 Nov 2011 07:01:49 -0800 Subject: 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. --- sleekxmpp/xmlstream/xmlstream.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'sleekxmpp') 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): """ -- cgit v1.2.3