Diff

plugins/mod_smacks.lua @ 12069:b9e08cbd032b

mod_smacks: Add more logging
author Kim Alvefur <zash@zash.se>
date Sat, 18 Dec 2021 12:50:09 +0100
parent 12068:c3790ffdf467
child 12070:e662c172ea0f
line wrap: on
line diff
--- a/plugins/mod_smacks.lua	Fri Dec 17 17:22:27 2021 +0100
+++ b/plugins/mod_smacks.lua	Sat Dec 18 12:50:09 2021 +0100
@@ -200,15 +200,21 @@
 module:hook("pre-session-close", function(event)
 	local session = event.session;
 	if session.resumption_token then
+		session.log("debug", "Revoking resumption token");
 		session_registry[jid.join(session.username, session.host, session.resumption_token)] = nil;
 		old_session_registry:set(session.username, session.resumption_token, nil);
 		session.resumption_token = nil;
+	else
+		session.log("debug", "Session not resumable");
 	end
 	if session.hibernating_watchdog then
+		session.log("debug", "Removing sleeping watchdog");
 		-- 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;
+	else
+		session.log("debug", "No watchdog set");
 	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
@@ -490,8 +496,11 @@
 		end;
 	else
 		if original_session.hibernating_watchdog then
+			original_session.log("debug", "Letting the watchdog go");
 			original_session.hibernating_watchdog:cancel();
 			original_session.hibernating_watchdog = nil;
+		else
+			original_session.log("error", "Hibernating session has no watchdog!")
 		end
 		session.log("debug", "mod_smacks resuming existing session %s...", get_session_id(original_session));
 		original_session.log("debug", "mod_smacks session resumed from %s...", get_session_id(session));