mod_smacks: Cancel hibernation when session is closed
authorKim Alvefur <zash@zash.se>
Thu, 16 Dec 2021 23:04:50 +0100
changeset 12066 4972244fe87b
parent 12065 31a7e0ac6928
child 12067 d308f6901397
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
--- a/plugins/mod_smacks.lua	Thu Dec 16 22:59:51 2021 +0100
+++ b/plugins/mod_smacks.lua	Thu Dec 16 23:04:50 2021 +0100
@@ -225,6 +225,12 @@
 		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", {