diff options
author | Matthew Wild <mwild1@gmail.com> | 2008-12-03 19:34:41 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2008-12-03 19:34:41 +0000 |
commit | fd7b0786e552e1a1d8dd978d3526f9ecddfa4f6b (patch) | |
tree | 30ee1a06f2c70b3f6128e7294d07cc6f625740ed /core/sessionmanager.lua | |
parent | d2d44b512ba429551e7ce843d64c25be745a8dd5 (diff) | |
parent | 11538c72c66d63aa440373558f36f646a2985ec1 (diff) | |
download | prosody-fd7b0786e552e1a1d8dd978d3526f9ecddfa4f6b.tar.gz prosody-fd7b0786e552e1a1d8dd978d3526f9ecddfa4f6b.zip |
Automated merge with http://84.46.7.57:1234
Diffstat (limited to 'core/sessionmanager.lua')
-rw-r--r-- | core/sessionmanager.lua | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/core/sessionmanager.lua b/core/sessionmanager.lua index d17a0357..36111633 100644 --- a/core/sessionmanager.lua +++ b/core/sessionmanager.lua @@ -70,14 +70,20 @@ 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; 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 |