Diff

plugins/mod_component.lua @ 7665:2e553f80aedd

mod_component: Fire 'component-disconnected' event on host, to maintain consistency - sessions with no host never authenticated. Fixes #737
author Matthew Wild <mwild1@gmail.com>
date Mon, 12 Sep 2016 22:30:37 +0100
parent 7301:995777582044
child 7666:03aa330562ed
child 7873:8d1ebb9a9b44
line wrap: on
line diff
--- a/plugins/mod_component.lua	Mon Sep 12 16:08:34 2016 +0200
+++ b/plugins/mod_component.lua	Mon Sep 12 22:30:37 2016 +0100
@@ -314,7 +314,9 @@
 	local session = sessions[conn];
 	if session then
 		(session.log or log)("info", "component disconnected: %s (%s)", tostring(session.host), tostring(err));
-		module:fire_event("component-disconnected", { session = session, reason = err });
+		if session.host then
+			module:context(session.host):fire_event("component-disconnected", { session = session, reason = err });
+		end
 		if session.on_destroy then session:on_destroy(err); end
 		sessions[conn] = nil;
 		for k in pairs(session) do