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
commita76e149c1ccbaa797e59754a39382d375a6a5070 (patch)
tree96313b17d1c5af47c62da95131c910c18f7aaaed
parentd6548d9810aef37d92fac4f51fbe47882407e6d4 (diff)
downloadprosody-a76e149c1ccbaa797e59754a39382d375a6a5070.tar.gz
prosody-a76e149c1ccbaa797e59754a39382d375a6a5070.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 aba99ee0..f2e95429 100644
--- a/core/s2smanager.lua
+++ b/core/s2smanager.lua
@@ -508,6 +508,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, reason)
(session.log or log)("info", "Destroying "..tostring(session.direction).." session "..tostring(session.from_host).."->"..tostring(session.to_host));
@@ -523,6 +525,7 @@ function destroy_session(session, reason)
session[k] = nil;
end
end
+ session.data = null_data_handler;
end
return _M;
diff --git a/core/sessionmanager.lua b/core/sessionmanager.lua
index a617d2ca..1d16b850 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)