comparison 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
comparison
equal deleted inserted replaced
1208:defa479a7d53 1209:fc39f78e2b36
34 34
35 local config = module:get_option("component_client", {}); 35 local config = module:get_option("component_client", {});
36 local server_host = config.host or "localhost"; 36 local server_host = config.host or "localhost";
37 local server_port = config.port or 5347; 37 local server_port = config.port or 5347;
38 local server_secret = config.secret or error("client_component.secret not provided"); 38 local server_secret = config.secret or error("client_component.secret not provided");
39 local exit_on_disconnect = config.exit_on_disconnect;
39 40
40 local __conn; 41 local __conn;
41 42
42 local listener = {}; 43 local listener = {};
43 local session; 44 local session;
210 session = nil; 211 session = nil;
211 end 212 end
212 __conn = nil; 213 __conn = nil;
213 module:log("error", "connection lost"); 214 module:log("error", "connection lost");
214 module:fire_event("component_client/disconnected", { reason = err }); 215 module:fire_event("component_client/disconnected", { reason = err });
216 if exit_on_disconnect then
217 prosody.shutdown("Shutdown by component_client disconnect");
218 end
215 end 219 end
216 220
217 function connect() 221 function connect()
218 ------------------------ 222 ------------------------
219 -- Taken from net.http 223 -- Taken from net.http