diff options
-rw-r--r-- | plugins/mod_component.lua | 4 |
1 files changed, 3 insertions, 1 deletions
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 |