Comparison

mod_component_client/mod_component_client.lua @ 1218:4c4536481be1

mod_component_client: Do a proper disconnect when the server is shutting down
author Waqas Hussain <waqas20@gmail.com>
date Thu, 31 Oct 2013 12:37:42 -0400
parent 1216:81a3bf8aba90
child 1220:6b9a56b959b8
comparison
equal deleted inserted replaced
1217:b3e2ed890b93 1218:4c4536481be1
247 local s, err = connect(); 247 local s, err = connect();
248 if not s then 248 if not s then
249 listener.ondisconnect(nil, err); 249 listener.ondisconnect(nil, err);
250 end 250 end
251 251
252 module:hook_global("server-stopping", function(event)
253 local reason = event.reason;
254 if session then
255 session:close{ condition = "system-shutdown", text = reason };
256 end
257 end, 1000);
258