summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2012-03-27 23:27:24 -0700
committerLance Stout <lancestout@gmail.com>2012-03-27 23:27:24 -0700
commitdda2473d351215309649646f4e5ffff8a9e6885a (patch)
tree6028b43aba302b8c12b6e97cb816b7e607af40f6
parent94923ae898b05a0b716dbb0e797e6a0f64f9b2e1 (diff)
downloadslixmpp-dda2473d351215309649646f4e5ffff8a9e6885a.tar.gz
slixmpp-dda2473d351215309649646f4e5ffff8a9e6885a.tar.bz2
slixmpp-dda2473d351215309649646f4e5ffff8a9e6885a.tar.xz
slixmpp-dda2473d351215309649646f4e5ffff8a9e6885a.zip
Reset stream management state on session_end.
-rw-r--r--sleekxmpp/plugins/xep_0198/stream_management.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/sleekxmpp/plugins/xep_0198/stream_management.py b/sleekxmpp/plugins/xep_0198/stream_management.py
index bc3f5a04..7045ad21 100644
--- a/sleekxmpp/plugins/xep_0198/stream_management.py
+++ b/sleekxmpp/plugins/xep_0198/stream_management.py
@@ -82,6 +82,10 @@ class XEP_0198(BasePlugin):
self.xmpp.register_stanza(stanza.Ack)
self.xmpp.register_stanza(stanza.RequestAck)
+ # Only end the session when a </stream> element is sent,
+ # not just because the connection has died.
+ self.xmpp.end_session_on_disconnect = False
+
# Register the feature twice because it may be ordered two
# different ways: enabling after binding and resumption
# before binding.
@@ -127,7 +131,16 @@ class XEP_0198(BasePlugin):
self.xmpp.add_filter('in', self._handle_incoming)
self.xmpp.add_filter('out_sync', self._handle_outgoing)
- self.xmpp.add_event_handler('need_ack', self.request_ack)
+ self.xmpp.add_event_handler('session_end', self.session_end)
+
+ def session_end(self, event):
+ """Reset stream management state."""
+ self.enabled.clear()
+ self.unacked_queue.clear()
+ self.sm_id = None
+ self.handled = 0
+ self.seq = 0
+ self.last_ack = 0
def send_ack(self):
"""Send the current ack count to the server."""