Diff

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
line wrap: on
line diff
--- a/core/sessionmanager.lua	Fri Feb 12 15:05:48 2010 +0000
+++ b/core/sessionmanager.lua	Fri Feb 12 17:14:54 2010 +0000
@@ -66,6 +66,8 @@
 	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 @@
 			session[k] = nil;
 		end
 	end
+	session.data = null_data_handler;
 end
 
 function make_authenticated(session, username)