mod_smacks: Remove references to connection on hibernation
authorKim Alvefur <zash@zash.se>
Sat, 18 Dec 2021 12:50:53 +0100
changeset 12074 e662c172ea0f
parent 12073 b9e08cbd032b
child 12075 85c8fcb4192e
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.
plugins/mod_smacks.lua
--- 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