aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2010-02-12 17:14:54 +0000
committerMatthew Wild <mwild1@gmail.com>2010-02-12 17:14:54 +0000
commit2739ed3948b9df3a596d6aef6d6790f1c2e1c59f (patch)
treedbefc3dcf32247c14c70f9ed966bf5ae87f04726
parent8e47276e919b4bd9b50916c9831e96158c0eeb4f (diff)
downloadprosody-2739ed3948b9df3a596d6aef6d6790f1c2e1c59f.tar.gz
prosody-2739ed3948b9df3a596d6aef6d6790f1c2e1c59f.zip
sessionmanager, s2smanager: Give sessions dummy data handlers that log when data is received by a destroyed session
-rw-r--r--core/s2smanager.lua3
-rw-r--r--core/sessionmanager.lua3
2 files changed, 6 insertions, 0 deletions
diff --git a/core/s2smanager.lua b/core/s2smanager.lua
index bfa3069a..7de97d0c 100644
--- a/core/s2smanager.lua
+++ b/core/s2smanager.lua
@@ -491,6 +491,8 @@ function mark_connected(session)
end
end
+local function null_data_handler(data) log("debug", "Discarding data from destroyed s2s session: %s", data); end
+
function destroy_session(session)
(session.log or log)("info", "Destroying "..tostring(session.direction).." session "..tostring(session.from_host).."->"..tostring(session.to_host));
@@ -506,6 +508,7 @@ function destroy_session(session)
session[k] = nil;
end
end
+ session.data = null_data_handler;
end
return _M;
diff --git a/core/sessionmanager.lua b/core/sessionmanager.lua
index df144f07..9df7823c 100644
--- a/core/sessionmanager.lua
+++ b/core/sessionmanager.lua
@@ -66,6 +66,8 @@ function new_session(conn)
return session;
end
+local function null_data_handler(data) log("debug", "Discarding data from destroyed c2s session: %s", data); end
+
function destroy_session(session, err)
(session.log or log)("info", "Destroying session for %s (%s@%s)", session.full_jid or "(unknown)", session.username or "(unknown)", session.host or "(unknown)");
@@ -88,6 +90,7 @@ function destroy_session(session, err)
session[k] = nil;
end
end
+ session.data = null_data_handler;
end
function make_authenticated(session, username)