diff options
author | Kim Alvefur <zash@zash.se> | 2019-03-24 20:43:15 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2019-03-24 20:43:15 +0100 |
commit | e887ed5cad52d2853ba66dfe1a7ec0762f4624df (patch) | |
tree | e01b462dfb32040cbfd17218858d6670f28fdb48 /plugins/mod_csi_simple.lua | |
parent | 1e77bb6ed2ac00b1e5f64f39da41ec140fe425ce (diff) | |
download | prosody-e887ed5cad52d2853ba66dfe1a7ec0762f4624df.tar.gz prosody-e887ed5cad52d2853ba66dfe1a7ec0762f4624df.zip |
mod_csi_simple: Disable optimizations on unload and re-enable on load
Diffstat (limited to 'plugins/mod_csi_simple.lua')
-rw-r--r-- | plugins/mod_csi_simple.lua | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/plugins/mod_csi_simple.lua b/plugins/mod_csi_simple.lua index 14abbc68..d0de222e 100644 --- a/plugins/mod_csi_simple.lua +++ b/plugins/mod_csi_simple.lua @@ -111,3 +111,24 @@ module:hook("c2s-ondrain", function (event) session.conn:pause_writes(); end end); + +function module.load() + for _, user_session in pairs(prosody.hosts[module.host].sessions) do + for _, session in pairs(user_session.sessions) do + if session.state == "inactive" then + enable_optimizations(session); + end + end + end +end + +function module.unload() + for _, user_session in pairs(prosody.hosts[module.host].sessions) do + for _, session in pairs(user_session.sessions) do + if session.state == "inactive" then + disble_optimizations(session); + end + end + end +end + |