From 4cb252484ceeac4c8ae6ae2896e58816f83266e9 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Fri, 28 Dec 2012 14:33:47 +0100 Subject: prosody, mod_c2s, mod_s2s: Move closing of c2s and s2s sessions to respective plugins --- plugins/mod_c2s.lua | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'plugins/mod_c2s.lua') diff --git a/plugins/mod_c2s.lua b/plugins/mod_c2s.lua index 72085113..89d678ca 100644 --- a/plugins/mod_c2s.lua +++ b/plugins/mod_c2s.lua @@ -265,6 +265,15 @@ function listener.associate_session(conn, session) 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; -- cgit v1.2.3