Mercurial > prosody-hg
comparison core/sessionmanager.lua @ 136:39dc16f3bf55
Merged from Matthew
| author | Waqas Hussain <waqas20@gmail.com> |
|---|---|
| date | Thu, 23 Oct 2008 22:07:36 +0500 |
| parents | 63863534b1f1 |
| children | fbb3a4ff9cf1 40e443eacbbd |
comparison
equal
deleted
inserted
replaced
| 135:bf10d42dd41b | 136:39dc16f3bf55 |
|---|---|
| 1 | 1 |
| 2 local tonumber, tostring = tonumber, tostring; | 2 local tonumber, tostring = tonumber, tostring; |
| 3 local ipairs, pairs, print= ipairs, pairs, print; | 3 local ipairs, pairs, print, next= ipairs, pairs, print, next; |
| 4 local collectgarbage = collectgarbage; | 4 local collectgarbage = collectgarbage; |
| 5 local m_random = import("math", "random"); | 5 local m_random = import("math", "random"); |
| 6 local format = import("string", "format"); | 6 local format = import("string", "format"); |
| 7 | 7 |
| 8 local hosts = hosts; | 8 local hosts = hosts; |
| 37 session.log("info", "Destroying session"); | 37 session.log("info", "Destroying session"); |
| 38 if session.username then | 38 if session.username then |
| 39 if session.resource then | 39 if session.resource then |
| 40 hosts[session.host].sessions[session.username].sessions[session.resource] = nil; | 40 hosts[session.host].sessions[session.username].sessions[session.resource] = nil; |
| 41 end | 41 end |
| 42 if not next(hosts[session.host].sessions[session.username], nil) then | 42 |
| 43 if not next(hosts[session.host].sessions[session.username].sessions) then | |
| 44 log("debug", "All resources of %s are now offline", session.username); | |
| 43 hosts[session.host].sessions[session.username] = nil; | 45 hosts[session.host].sessions[session.username] = nil; |
| 44 end | 46 end |
| 45 end | 47 end |
| 46 session.conn = nil; | 48 session.conn = nil; |
| 47 session.disconnect = nil; | 49 session.disconnect = nil; |
