From e10845657cc02ea806676e6f4825481cfd48929b Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Thu, 16 Dec 2021 23:04:50 +0100 Subject: mod_smacks: Cancel hibernation when session is closed To ensure that if a session is replaced after it has gone into hibernation, it does not come back and cause trouble for the new session (see previous commit). --- plugins/mod_smacks.lua | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'plugins/mod_smacks.lua') diff --git a/plugins/mod_smacks.lua b/plugins/mod_smacks.lua index 2dc8f1ff..6d872f5a 100644 --- a/plugins/mod_smacks.lua +++ b/plugins/mod_smacks.lua @@ -225,6 +225,12 @@ module:hook("pre-session-close", function(event) old_session_registry:set(session.username, session.resumption_token, nil); session.resumption_token = nil; end + if session.hibernating_watchdog then + -- If the session is being replaced instead of resume, we don't want the + -- old session around to time out and cause trouble for the new session + session.hibernating_watchdog:cancel(); + session.hibernating_watchdog = nil; + end -- send out last ack as per revision 1.5.2 of XEP-0198 if session.smacks and session.conn and session.handled_stanza_count then (session.sends2s or session.send)(st.stanza("a", { -- cgit v1.2.3