summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--slixmpp/plugins/xep_0198/stream_management.py28
1 files changed, 14 insertions, 14 deletions
diff --git a/slixmpp/plugins/xep_0198/stream_management.py b/slixmpp/plugins/xep_0198/stream_management.py
index 0200646a..30274ecf 100644
--- a/slixmpp/plugins/xep_0198/stream_management.py
+++ b/slixmpp/plugins/xep_0198/stream_management.py
@@ -198,20 +198,7 @@ class XEP_0198(BasePlugin):
# We've already negotiated stream management,
# so no need to do it again.
return False
- if not self.sm_id:
- if 'bind' in self.xmpp.features:
- enable = stanza.Enable(self.xmpp)
- enable['resume'] = self.allow_resume
- enable.send()
- log.debug("enabling SM")
-
- waiter = Waiter('enabled_or_failed',
- MatchMany([
- MatchXPath(stanza.Enabled.tag_name()),
- MatchXPath(stanza.Failed.tag_name())]))
- self.xmpp.register_handler(waiter)
- result = await waiter.wait()
- elif self.sm_id and self.allow_resume and 'bind' not in self.xmpp.features:
+ if self.sm_id and self.allow_resume and 'bind' not in self.xmpp.features:
resume = stanza.Resume(self.xmpp)
resume['h'] = self.handled
resume['previd'] = self.sm_id
@@ -229,6 +216,19 @@ class XEP_0198(BasePlugin):
result = await waiter.wait()
if result is not None and result.name == 'resumed':
return True
+ self.xmpp.event("session_end")
+ if 'bind' in self.xmpp.features:
+ enable = stanza.Enable(self.xmpp)
+ enable['resume'] = self.allow_resume
+ enable.send()
+ log.debug("enabling SM")
+
+ waiter = Waiter('enabled_or_failed',
+ MatchMany([
+ MatchXPath(stanza.Enabled.tag_name()),
+ MatchXPath(stanza.Failed.tag_name())]))
+ self.xmpp.register_handler(waiter)
+ result = await waiter.wait()
return False
def _handle_enabled(self, stanza):