From f04d5613829f64ceed87e0652fcbcd6f602833d3 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Mon, 12 Sep 2016 22:30:37 +0100 Subject: mod_component: Fire 'component-disconnected' event on host, to maintain consistency - sessions with no host never authenticated. Fixes #737 --- plugins/mod_component.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'plugins/mod_component.lua') diff --git a/plugins/mod_component.lua b/plugins/mod_component.lua index eebaaf3e..0de4d23f 100644 --- a/plugins/mod_component.lua +++ b/plugins/mod_component.lua @@ -314,7 +314,9 @@ function listener.ondisconnect(conn, err) 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 -- cgit v1.2.3