Changeset

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 12069:b9e08cbd032b
children 12071:85c8fcb4192e
files plugins/mod_smacks.lua
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
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