Software /
code /
prosody
Changeset
12880:b56a2731bf00
Merge 0.12->trunk
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 09 Feb 2023 22:34:05 +0000 |
parents | 12876:0ed24f48b6a6 (current diff) 12879:09a53ed8f4d5 (diff) |
children | 12883:0d5868a9e641 |
files | core/sessionmanager.lua |
diffstat | 1 files changed, 11 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/core/sessionmanager.lua Tue Jan 31 16:27:55 2023 +0100 +++ b/core/sessionmanager.lua Thu Feb 09 22:34:05 2023 +0000 @@ -138,10 +138,6 @@ end local function destroy_session(session, err) - (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 ""); - if session.destroyed then return; end -- Remove session/resource from user's session list @@ -150,9 +146,16 @@ -- 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; full_sessions[session.full_jid] = nil; @@ -163,6 +166,10 @@ 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);