From fff5a91e376d1cd7eddb7be6d18920fa2efaaa4d Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Tue, 19 Nov 2024 00:53:01 +0100 Subject: 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. --- plugins/mod_smacks.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/mod_smacks.lua b/plugins/mod_smacks.lua index 7a9a67b3..62cf9dd1 100644 --- a/plugins/mod_smacks.lua +++ b/plugins/mod_smacks.lua @@ -587,6 +587,11 @@ function do_resume(session, stanza) 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 -- cgit v1.2.3