Diff

plugins/mod_s2s/mod_s2s.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 5274:0d08c0965824
child 5307:d80e56d8805c
line wrap: on
line diff
--- a/plugins/mod_s2s/mod_s2s.lua	Fri Dec 28 14:33:27 2012 +0100
+++ b/plugins/mod_s2s/mod_s2s.lua	Fri Dec 28 14:33:47 2012 +0100
@@ -506,6 +506,15 @@
 
 s2sout.set_listener(listener);
 
+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,500);
+
+
+
 module:provides("net", {
 	name = "s2s";
 	listener = listener;