Changeset

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
parents 1217:b3e2ed890b93
children 1219:f53475ee7ff4
files mod_component_client/mod_component_client.lua
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
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);
+