From 912463ed6ac3cc8fc751497e82580f48a2a7218e Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Wed, 28 Mar 2012 23:53:55 -0700 Subject: Fix sending data after Clearing the session_started_event before sending will pause the send loop so that we don't continue sending data after the . --- sleekxmpp/xmlstream/xmlstream.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sleekxmpp/xmlstream/xmlstream.py b/sleekxmpp/xmlstream/xmlstream.py index c91bf066..45f27929 100644 --- a/sleekxmpp/xmlstream/xmlstream.py +++ b/sleekxmpp/xmlstream/xmlstream.py @@ -628,17 +628,20 @@ class XMLStream(object): elif self.disconnect_wait: self.send_queue.join() + # Clearing this event will pause the send loop. + self.session_started_event.clear() + # Send the end of stream marker. if send_close: self.send_raw(self.stream_footer, now=True) - self.session_started_event.clear() + # 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.debug('Waiting for %s from server', self.stream_footer) + log.info('Waiting for %s from server', self.stream_footer) self.stream_end_event.wait(4) else: self.stream_end_event.set() -- cgit v1.2.3