Changeset

12062:4972244fe87b

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).
author Kim Alvefur <zash@zash.se>
date Thu, 16 Dec 2021 23:04:50 +0100
parents 12061:31a7e0ac6928
children 12063:d308f6901397
files plugins/mod_smacks.lua
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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", {