Comparison

core/sessionmanager.lua @ 12877:f6cca7cbf3b2 0.12

core.sessionmanager: Skip log when (not) destroying destroyed sessions On regular disconnects, </stream> is sent, then sessionmanager.destroy_session() is called, then sessionmanager.destroy_session() is called again when the TCP connection is closed, from ondisconnect in mod_c2s. It is a bit annoying and doesn't really tell you much.
author Kim Alvefur <zash@zash.se>
date Thu, 19 Jan 2023 21:38:14 +0100
parent 11518:3f1a865e9419
child 12878:0d8bf401fa73
comparison
equal deleted inserted replaced
12863:891edd1ebde6 12877:f6cca7cbf3b2
91 session.thread = { run = function (_, data) return session.data(data) end }; 91 session.thread = { run = function (_, data) return session.data(data) end };
92 return setmetatable(session, resting_session); 92 return setmetatable(session, resting_session);
93 end 93 end
94 94
95 local function destroy_session(session, err) 95 local function destroy_session(session, err)
96 if session.destroyed then return; end
96 (session.log or log)("debug", "Destroying session for %s (%s@%s)%s", 97 (session.log or log)("debug", "Destroying session for %s (%s@%s)%s",
97 session.full_jid or "(unknown)", session.username or "(unknown)", 98 session.full_jid or "(unknown)", session.username or "(unknown)",
98 session.host or "(unknown)", err and (": "..err) or ""); 99 session.host or "(unknown)", err and (": "..err) or "");
99
100 if session.destroyed then return; end
101 100
102 -- Remove session/resource from user's session list 101 -- Remove session/resource from user's session list
103 if session.full_jid then 102 if session.full_jid then
104 local host_session = hosts[session.host]; 103 local host_session = hosts[session.host];
105 104