Changeset

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
parents 13571:ca041359c045
children 13573:9277fc78fe39
files plugins/mod_smacks.lua
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
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