Software /
code /
prosody
Comparison
core/sessionmanager.lua @ 2857:6036c4b75235
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 | 2832:8c754c61c72e |
child | 2858:d08771a2f617 |
comparison
equal
deleted
inserted
replaced
2856:70e6ea49aff3 | 2857:6036c4b75235 |
---|---|
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 |