Diff

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
line wrap: on
line diff
--- a/mod_component_client/mod_component_client.lua	Tue Oct 29 01:47:59 2013 +0100
+++ b/mod_component_client/mod_component_client.lua	Thu Oct 31 12:37:42 2013 -0400
@@ -249,3 +249,10 @@
 	listener.ondisconnect(nil, err);
 end
 
+module:hook_global("server-stopping", function(event)
+	local reason = event.reason;
+	if session then
+		session:close{ condition = "system-shutdown", text = reason };
+	end
+end, 1000);
+