From 2739ed3948b9df3a596d6aef6d6790f1c2e1c59f Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Fri, 12 Feb 2010 17:14:54 +0000 Subject: sessionmanager, s2smanager: Give sessions dummy data handlers that log when data is received by a destroyed session --- core/s2smanager.lua | 3 +++ core/sessionmanager.lua | 3 +++ 2 files changed, 6 insertions(+) (limited to 'core') 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) -- cgit v1.2.3