core.sessionmanager: Skip log when (not) destroying destroyed sessions 0.12
authorKim Alvefur <zash@zash.se>
Thu, 19 Jan 2023 21:38:14 +0100
branch0.12
changeset 12881 f6cca7cbf3b2
parent 12867 891edd1ebde6
child 12882 0d8bf401fa73
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.
core/sessionmanager.lua
--- a/core/sessionmanager.lua	Sun Jan 22 14:45:47 2023 +0100
+++ b/core/sessionmanager.lua	Thu Jan 19 21:38:14 2023 +0100
@@ -93,12 +93,11 @@
 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 "");
 
-	if session.destroyed then return; end
-
 	-- Remove session/resource from user's session list
 	if session.full_jid then
 		local host_session = hosts[session.host];