diff options
author | Waqas Hussain <waqas20@gmail.com> | 2009-05-29 23:22:58 +0500 |
---|---|---|
committer | Waqas Hussain <waqas20@gmail.com> | 2009-05-29 23:22:58 +0500 |
commit | aeeeeb288fe83c22156bb4919419d5453c897635 (patch) | |
tree | 91ca1e0f961a36bbbddf24941731a241397237d1 /core | |
parent | 2424f767f5a64e95cc65c314db5331285686e3ab (diff) | |
download | prosody-aeeeeb288fe83c22156bb4919419d5453c897635.tar.gz prosody-aeeeeb288fe83c22156bb4919419d5453c897635.zip |
sessionmanager: Fixed an old FIXME: A problem caused by an error on an authenticated but unbound session
Diffstat (limited to 'core')
-rw-r--r-- | core/sessionmanager.lua | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/core/sessionmanager.lua b/core/sessionmanager.lua index 2a221750..08e9b7ed 100644 --- a/core/sessionmanager.lua +++ b/core/sessionmanager.lua @@ -65,23 +65,16 @@ function destroy_session(session, err) 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 |