Diff

plugins/mod_c2s.lua @ 5281:815c689f85ad

prosody, mod_c2s, mod_s2s: Move closing of c2s and s2s sessions to respective plugins
author Kim Alvefur <zash@zash.se>
date Fri, 28 Dec 2012 14:33:47 +0100
parent 5228:edabb34417b7
child 5370:7838acadb0fa
line wrap: on
line diff
--- a/plugins/mod_c2s.lua	Fri Dec 28 14:33:27 2012 +0100
+++ b/plugins/mod_c2s.lua	Fri Dec 28 14:33:47 2012 +0100
@@ -265,6 +265,15 @@
 	sessions[conn] = session;
 end
 
+module:hook("server-stopping", function(event)
+	local reason = event.reason;
+	for _, session in pairs(sessions) do
+		session:close{ condition = "system-shutdown", text = reason };
+	end
+end, 1000);
+
+
+
 module:provides("net", {
 	name = "c2s";
 	listener = listener;