Software / code / prosody
Comparison
core/sessionmanager.lua @ 1225:1e01a913baf5
sessionmanager: Fixed an old FIXME: A problem caused by an error on an authenticated but unbound session
| author | Waqas Hussain <waqas20@gmail.com> |
|---|---|
| date | Fri, 29 May 2009 23:22:58 +0500 |
| parent | 1224:35fa588e43a6 |
| child | 1226:3b5f9dac2045 |
comparison
equal
deleted
inserted
replaced
| 1224:35fa588e43a6 | 1225:1e01a913baf5 |
|---|---|
| 63 pres:tag("status"):text("Disconnected: "..err):up(); | 63 pres:tag("status"):text("Disconnected: "..err):up(); |
| 64 session:dispatch_stanza(pres); | 64 session:dispatch_stanza(pres); |
| 65 end | 65 end |
| 66 | 66 |
| 67 -- Remove session/resource from user's session list | 67 -- Remove session/resource from user's session list |
| 68 if session.host and session.username then | 68 if session.full_jid then |
| 69 -- FIXME: How can the below ever be nil? (but they sometimes are...) | 69 if session.resource then |
| 70 if hosts[session.host] and hosts[session.host].sessions[session.username] then | 70 hosts[session.host].sessions[session.username].sessions[session.resource] = nil; |
| 71 if session.resource then | 71 full_sessions[session.full_jid] = nil; |
| 72 hosts[session.host].sessions[session.username].sessions[session.resource] = nil; | 72 end |
| 73 full_sessions[session.full_jid] = nil; | 73 |
| 74 end | 74 if not next(hosts[session.host].sessions[session.username].sessions) then |
| 75 | 75 log("debug", "All resources of %s are now offline", session.username); |
| 76 if not next(hosts[session.host].sessions[session.username].sessions) then | 76 hosts[session.host].sessions[session.username] = nil; |
| 77 log("debug", "All resources of %s are now offline", session.username); | 77 bare_sessions[session.host..'@'..session.username] = nil; |
| 78 hosts[session.host].sessions[session.username] = nil; | |
| 79 bare_sessions[session.host..'@'..session.username] = nil; | |
| 80 end | |
| 81 else | |
| 82 log("error", "host or session table didn't exist, please report this! Host: %s [%s] Sessions: %s [%s]", | |
| 83 tostring(hosts[session.host]), tostring(session.host), | |
| 84 tostring(hosts[session.host].sessions[session.username] ), tostring(session.username)); | |
| 85 end | 78 end |
| 86 end | 79 end |
| 87 | 80 |
| 88 for k in pairs(session) do | 81 for k in pairs(session) do |
| 89 if k ~= "trace" then | 82 if k ~= "trace" then |