Changeset

1209:fc39f78e2b36

mod_component_client: Added component_client.exit_on_disconnect config option
author Waqas Hussain <waqas20@gmail.com>
date Fri, 11 Oct 2013 16:59:23 -0400
parents 1208:defa479a7d53
children 1210:be5334e3f6ca
files mod_component_client/mod_component_client.lua
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mod_component_client/mod_component_client.lua	Fri Oct 11 16:56:06 2013 -0400
+++ b/mod_component_client/mod_component_client.lua	Fri Oct 11 16:59:23 2013 -0400
@@ -36,6 +36,7 @@
 local server_host = config.host or "localhost";
 local server_port = config.port or 5347;
 local server_secret = config.secret or error("client_component.secret not provided");
+local exit_on_disconnect = config.exit_on_disconnect;
 
 local __conn;
 
@@ -212,6 +213,9 @@
 	__conn = nil;
 	module:log("error", "connection lost");
 	module:fire_event("component_client/disconnected", { reason = err });
+	if exit_on_disconnect then
+		prosody.shutdown("Shutdown by component_client disconnect");
+	end
 end
 
 function connect()