mod_component: Fire event when component disconnects

This commit is contained in:
Matthew Wild 2016-03-18 13:58:55 +00:00
parent 5092b5f5d2
commit 4b907ce3ff

View file

@ -314,6 +314,7 @@ 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.on_destroy then session:on_destroy(err); end
sessions[conn] = nil;
for k in pairs(session) do