From 80a90a6221733d0985f0d585b3abbd1d8fab70b0 Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Sat, 4 Aug 2012 21:10:45 -0700 Subject: [PATCH 1/3] Prevent auto_reconnect interference when disconnecting. --- sleekxmpp/xmlstream/xmlstream.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sleekxmpp/xmlstream/xmlstream.py b/sleekxmpp/xmlstream/xmlstream.py index 51dc25ed..4e5e2fe4 100644 --- a/sleekxmpp/xmlstream/xmlstream.py +++ b/sleekxmpp/xmlstream/xmlstream.py @@ -692,11 +692,13 @@ class XMLStream(object): if send_close: self.send_raw(self.stream_footer, now=True) + if not reconnect: + self.auto_reconnect = False + # Wait for confirmation that the stream was # closed in the other direction. If we didn't # send a stream footer we don't need to wait # since the server won't know to respond. - self.auto_reconnect = reconnect if send_close: log.info('Waiting for %s from server', self.stream_footer) self.stream_end_event.wait(4) From 8c2ece3bca24c8b6452860db916713b55455050e Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Sat, 4 Aug 2012 21:37:46 -0700 Subject: [PATCH 2/3] Ensure self._der_cert exists even if no certs are used. --- sleekxmpp/xmlstream/xmlstream.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sleekxmpp/xmlstream/xmlstream.py b/sleekxmpp/xmlstream/xmlstream.py index 4e5e2fe4..216c0ed3 100644 --- a/sleekxmpp/xmlstream/xmlstream.py +++ b/sleekxmpp/xmlstream/xmlstream.py @@ -147,6 +147,8 @@ class XMLStream(object): #: client certificate to use for authenticating via SASL EXTERNAL. self.keyfile = None + self._der_cert = None + #: The time in seconds to wait for events from the event queue, #: and also the time between checks for the process stop signal. self.wait_timeout = WAIT_TIMEOUT From aebcf6ff828bf179af95df38d7f8ffa54f289c36 Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Tue, 7 Aug 2012 01:38:15 -0700 Subject: [PATCH 3/3] Re-add connection delay after exhausting DNS records. --- sleekxmpp/xmlstream/xmlstream.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sleekxmpp/xmlstream/xmlstream.py b/sleekxmpp/xmlstream/xmlstream.py index 216c0ed3..f72171a1 100644 --- a/sleekxmpp/xmlstream/xmlstream.py +++ b/sleekxmpp/xmlstream/xmlstream.py @@ -479,7 +479,7 @@ class XMLStream(object): log.debug("No remaining DNS records to try.") self.dns_answers = None if reattempt: - self.reconnect_delay = None + self.reconnect_delay = delay return False af = Socket.AF_INET