aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2023-02-09 15:09:03 +0000
committerMatthew Wild <mwild1@gmail.com>2023-02-09 15:09:03 +0000
commita4556fc67aa2036bc0f7d95d5f61ba7e95412304 (patch)
tree7216c865e2fb23a6e923d4d9c50e35e160cd217b /core
parentd616d70f3c7b9cb76a488ef69173d6340131bd62 (diff)
downloadprosody-a4556fc67aa2036bc0f7d95d5f61ba7e95412304.tar.gz
prosody-a4556fc67aa2036bc0f7d95d5f61ba7e95412304.zip
sessionmanager: Improve logging around session destruction
Diffstat (limited to 'core')
-rw-r--r--core/sessionmanager.lua13
1 files changed, 10 insertions, 3 deletions
diff --git a/core/sessionmanager.lua b/core/sessionmanager.lua
index ecc829e4..f8279bb4 100644
--- a/core/sessionmanager.lua
+++ b/core/sessionmanager.lua
@@ -94,9 +94,6 @@ end
local function destroy_session(session, err)
if session.destroyed then return; end
- (session.log or log)("debug", "Destroying session for %s (%s@%s)%s",
- session.full_jid or "(unknown)", session.username or "(unknown)",
- session.host or "(unknown)", err and (": "..err) or "");
-- Remove session/resource from user's session list
if session.full_jid then
@@ -104,8 +101,14 @@ local function destroy_session(session, err)
-- Allow plugins to prevent session destruction
if host_session.events.fire_event("pre-resource-unbind", {session=session, error=err}) then
+ (session.log or log)("debug", "Resource unbind prevented by module");
return;
end
+
+ (session.log or log)("debug", "Unbinding resource for %s (%s@%s)%s",
+ session.full_jid or "(unknown)", session.username or "(unknown)",
+ session.host or "(unknown)", err and (": "..err) or "");
+
session.destroyed = true; -- Past this point the session is DOOMED!
host_session.sessions[session.username].sessions[session.resource] = nil;
@@ -118,6 +121,10 @@ local function destroy_session(session, err)
end
host_session.events.fire_event("resource-unbind", {session=session, error=err});
+ else
+ (session.log or log)("debug", "Destroying unbound session for <%s@%s>%s",
+ session.username or "(unknown)", session.host or "(unknown)",
+ err and (": "..err) or "");
end
retire_session(session);