diff options
author | Lance Stout <lancestout@gmail.com> | 2012-03-28 23:53:55 -0700 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2012-03-28 23:53:55 -0700 |
commit | 912463ed6ac3cc8fc751497e82580f48a2a7218e (patch) | |
tree | 3e04c0ee8494c72332e73732a2e420715ab23618 | |
parent | dda2473d351215309649646f4e5ffff8a9e6885a (diff) | |
download | slixmpp-912463ed6ac3cc8fc751497e82580f48a2a7218e.tar.gz slixmpp-912463ed6ac3cc8fc751497e82580f48a2a7218e.tar.bz2 slixmpp-912463ed6ac3cc8fc751497e82580f48a2a7218e.tar.xz slixmpp-912463ed6ac3cc8fc751497e82580f48a2a7218e.zip |
Fix sending data after </stream>
Clearing the session_started_event before sending </stream> will
pause the send loop so that we don't continue sending data after
the </stream>.
-rw-r--r-- | sleekxmpp/xmlstream/xmlstream.py | 7 |
1 files 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() |