From 396d493b18d04e81c5d5a7d67fc9ef7c16be9558 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Wed, 3 Dec 2008 18:01:56 +0000 Subject: Quick fix for an issue that needs more looking into --- core/sessionmanager.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'core') diff --git a/core/sessionmanager.lua b/core/sessionmanager.lua index d17a0357..98c41962 100644 --- a/core/sessionmanager.lua +++ b/core/sessionmanager.lua @@ -70,10 +70,12 @@ function destroy_session(session, err) -- Remove session/resource from user's session list if session.host and session.username then - if session.resource then - hosts[session.host].sessions[session.username].sessions[session.resource] = nil; - end + -- FIXME: How can the below ever be nil? (but they sometimes are...) if hosts[session.host] and hosts[session.host].sessions[session.username] then + if session.resource then + hosts[session.host].sessions[session.username].sessions[session.resource] = nil; + end + if not next(hosts[session.host].sessions[session.username].sessions) then log("debug", "All resources of %s are now offline", session.username); hosts[session.host].sessions[session.username] = nil; -- cgit v1.2.3 From 11538c72c66d63aa440373558f36f646a2985ec1 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Wed, 3 Dec 2008 18:06:04 +0000 Subject: Added an error log message for this case --- core/sessionmanager.lua | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'core') diff --git a/core/sessionmanager.lua b/core/sessionmanager.lua index 98c41962..36111633 100644 --- a/core/sessionmanager.lua +++ b/core/sessionmanager.lua @@ -80,6 +80,10 @@ function destroy_session(session, err) log("debug", "All resources of %s are now offline", session.username); hosts[session.host].sessions[session.username] = nil; end + else + log("error", "host or session table didn't exist, please report this! Host: %s [%s] Sessions: %s [%s]", + tostring(hosts[session.host]), tostring(session.host), + tostring(hosts[session.host].sessions[session.username] ), tostring(session.username)); end end -- cgit v1.2.3