diff plugins/mod_smacks.lua @ 12070:e662c172ea0f

mod_smacks: Remove references to connection on hibernation Still having the connection on the session may cause unintentional behavior, such as the session being treated as if connected, even tho the connection has been closed.
author Kim Alvefur <zash@zash.se>
date Sat, 18 Dec 2021 12:50:53 +0100
parents b9e08cbd032b
children ef0f174488af
line wrap: on
line diff
--- a/plugins/mod_smacks.lua	Sat Dec 18 12:50:09 2021 +0100
+++ b/plugins/mod_smacks.lua	Sat Dec 18 12:50:53 2021 +0100
@@ -440,7 +440,10 @@
 		sessionmanager.destroy_session(session, "Hibernating too long");
 	end);
 	if session.conn then
-		session.conn:close();
+		local conn = session.conn;
+		c2s_sessions[conn] = nil;
+		session.conn = nil;
+		conn:close();
 	end
 	module:fire_event("smacks-hibernation-start", { origin = session; queue = session.outgoing_stanza_queue:table() });
 	return true; -- Postpone destruction for now