# HG changeset patch # User Waqas Hussain <waqas20@gmail.com> # Date 1243621378 -18000 # Node ID 1e01a913baf524e7b6d28588a62af681ec3eb7bb # Parent 35fa588e43a6b84ede5030f8e45eded83300b341 sessionmanager: Fixed an old FIXME: A problem caused by an error on an authenticated but unbound session diff -r 35fa588e43a6 -r 1e01a913baf5 core/sessionmanager.lua --- a/core/sessionmanager.lua Fri May 29 23:14:57 2009 +0500 +++ b/core/sessionmanager.lua Fri May 29 23:22:58 2009 +0500 @@ -65,23 +65,16 @@ end -- Remove session/resource from user's session list - if session.host and session.username then - -- 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; - full_sessions[session.full_jid] = 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; - bare_sessions[session.host..'@'..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)); + if session.full_jid then + if session.resource then + hosts[session.host].sessions[session.username].sessions[session.resource] = nil; + full_sessions[session.full_jid] = 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; + bare_sessions[session.host..'@'..session.username] = nil; end end