changeset 2865:9213c6dff48d

plugin XEP-0198: reset req_timer on session.reset(): req_timer may not have been called when session.reset() is called (e.g. on resuming failed after computer has been suspended), so reset() must cancel it and set its value to None.
author Goffi <goffi@goffi.org>
date Thu, 21 Mar 2019 08:54:59 +0100
parents 33a69ee7fbb7
children 8ce5748bfe97
files sat/plugins/plugin_xep_0198.py
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/sat/plugins/plugin_xep_0198.py	Wed Mar 20 19:33:38 2019 +0100
+++ b/sat/plugins/plugin_xep_0198.py	Thu Mar 21 08:54:59 2019 +0100
@@ -116,6 +116,12 @@
         self.session_id = self.location = None
         self.ack_requested = False
         self.last_ack_r = 0
+        if self.req_timer is not None:
+            if self.req_timer.active():
+                log.error(u"req_timer has been called/cancelled but not reset")
+            else:
+                self.req_timer.cancel()
+            self.req_timer = None
 
 
 class XEP_0198(object):