Changeset

7300:66e7517bd8f3

mod_component: Fire event when component disconnects
author Matthew Wild <mwild1@gmail.com>
date Fri, 18 Mar 2016 13:58:55 +0000
parents 7299:b7dea8fd09c7
children 7301:995777582044
files plugins/mod_component.lua
diffstat 1 files changed, 1 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_component.lua	Fri Mar 18 11:55:40 2016 +0100
+++ b/plugins/mod_component.lua	Fri Mar 18 13:58:55 2016 +0000
@@ -314,6 +314,7 @@
 	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