Changeset

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
parents 7664:4f145a9f1477
children 7666:03aa330562ed 7670:2be85cb3bc66
files plugins/mod_component.lua
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
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