Comparison

core/sessionmanager.lua @ 149:40e443eacbbd

Partial s2s commit
author Matthew Wild <mwild1@gmail.com>
date Fri, 24 Oct 2008 07:34:13 +0100
parent 126:63863534b1f1
child 150:d09b8a1ab046
comparison
equal deleted inserted replaced
143:e0f20546cd68 149:40e443eacbbd
33 return session; 33 return session;
34 end 34 end
35 35
36 function destroy_session(session) 36 function destroy_session(session)
37 session.log("info", "Destroying session"); 37 session.log("info", "Destroying session");
38 if session.username then 38 if session.host and 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 42 if hosts[session.host] and hosts[session.host].sessions[session.username] then
43 if not next(hosts[session.host].sessions[session.username].sessions) then 43 if not next(hosts[session.host].sessions[session.username].sessions) then
44 log("debug", "All resources of %s are now offline", session.username); 44 log("debug", "All resources of %s are now offline", session.username);
45 hosts[session.host].sessions[session.username] = nil; 45 hosts[session.host].sessions[session.username] = nil;
46 end
46 end 47 end
47 end 48 end
48 session.conn = nil; 49 session.conn = nil;
49 session.disconnect = nil; 50 session.disconnect = nil;
50 for k in pairs(session) do 51 for k in pairs(session) do