diff mod_component_client/mod_component_client.lua @ 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 defa479a7d53
children be5334e3f6ca
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()