Diff

plugins/mod_smacks.lua @ 13572:d9965707f7dc

mod_smacks: Prevent traceback on attempting to resume destroyed session This shouldn't be possible, but seems to happen anyway after net.server somehow calling the close handler twice, which also should not happen.
author Kim Alvefur <zash@zash.se>
date Tue, 19 Nov 2024 00:53:01 +0100
parent 13544:0aae6de9d323
child 13573:9277fc78fe39
line wrap: on
line diff
--- a/plugins/mod_smacks.lua	Tue Nov 19 00:41:02 2024 +0100
+++ b/plugins/mod_smacks.lua	Tue Nov 19 00:53:01 2024 +0100
@@ -587,6 +587,11 @@
 
 	local id = stanza.attr.previd;
 	local original_session = session_registry[registry_key(session, id)];
+	if original_session.destroyed then
+		original_session.log("error", "Tried to resume a destroyed session. This should not happen! %s", debug.traceback());
+		session_registry[registry_key(session, id)] = nil;
+		original_session = nil;
+	end
 	if not original_session then
 		local old_session = old_session_registry:get(session.username, id);
 		if old_session then