diff options
author | Kim Alvefur <zash@zash.se> | 2012-12-28 14:33:47 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2012-12-28 14:33:47 +0100 |
commit | 4cb252484ceeac4c8ae6ae2896e58816f83266e9 (patch) | |
tree | 44b919ba59445e4f92b30ff080456c7eda4e59ad /plugins | |
parent | b0249c4d4a286172d1f548d0a65bf6154b34e1e8 (diff) | |
download | prosody-4cb252484ceeac4c8ae6ae2896e58816f83266e9.tar.gz prosody-4cb252484ceeac4c8ae6ae2896e58816f83266e9.zip |
prosody, mod_c2s, mod_s2s: Move closing of c2s and s2s sessions to respective plugins
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mod_c2s.lua | 9 | ||||
-rw-r--r-- | plugins/mod_s2s/mod_s2s.lua | 9 |
2 files changed, 18 insertions, 0 deletions
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; diff --git a/plugins/mod_s2s/mod_s2s.lua b/plugins/mod_s2s/mod_s2s.lua index 788a64af..ad628a9b 100644 --- a/plugins/mod_s2s/mod_s2s.lua +++ b/plugins/mod_s2s/mod_s2s.lua @@ -506,6 +506,15 @@ end 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; |