aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-12-16 23:04:50 +0100
committerKim Alvefur <zash@zash.se>2021-12-16 23:04:50 +0100
commite10845657cc02ea806676e6f4825481cfd48929b (patch)
treeb1e853cddd475d535d189ebd64339cdff9a52fb4
parent6745972708034e703560ed6b05a63d1371c93977 (diff)
downloadprosody-e10845657cc02ea806676e6f4825481cfd48929b.tar.gz
prosody-e10845657cc02ea806676e6f4825481cfd48929b.zip
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).
-rw-r--r--plugins/mod_smacks.lua6
1 files changed, 6 insertions, 0 deletions
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", {