Comparison

core/sessionmanager.lua @ 2621:4d0f9f50fdd8

sessionmanager, s2smanager: Give sessions dummy data handlers that log when data is received by a destroyed session
author Matthew Wild <mwild1@gmail.com>
date Fri, 12 Feb 2010 17:14:54 +0000
parent 2606:c3fe88d4b921
child 2622:5ced53147f86
comparison
equal deleted inserted replaced
2620:481c6724818f 2621:4d0f9f50fdd8
64 end 64 end
65 65
66 return session; 66 return session;
67 end 67 end
68 68
69 local function null_data_handler(data) log("debug", "Discarding data from destroyed c2s session: %s", data); end
70
69 function destroy_session(session, err) 71 function destroy_session(session, err)
70 (session.log or log)("info", "Destroying session for %s (%s@%s)", session.full_jid or "(unknown)", session.username or "(unknown)", session.host or "(unknown)"); 72 (session.log or log)("info", "Destroying session for %s (%s@%s)", session.full_jid or "(unknown)", session.username or "(unknown)", session.host or "(unknown)");
71 73
72 -- Remove session/resource from user's session list 74 -- Remove session/resource from user's session list
73 if session.full_jid then 75 if session.full_jid then
86 for k in pairs(session) do 88 for k in pairs(session) do
87 if k ~= "trace" then 89 if k ~= "trace" then
88 session[k] = nil; 90 session[k] = nil;
89 end 91 end
90 end 92 end
93 session.data = null_data_handler;
91 end 94 end
92 95
93 function make_authenticated(session, username) 96 function make_authenticated(session, username)
94 session.username = username; 97 session.username = username;
95 if session.type == "c2s_unauthed" then 98 if session.type == "c2s_unauthed" then