aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_csi_simple.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2019-03-24 20:43:15 +0100
committerKim Alvefur <zash@zash.se>2019-03-24 20:43:15 +0100
commite887ed5cad52d2853ba66dfe1a7ec0762f4624df (patch)
treee01b462dfb32040cbfd17218858d6670f28fdb48 /plugins/mod_csi_simple.lua
parent1e77bb6ed2ac00b1e5f64f39da41ec140fe425ce (diff)
downloadprosody-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.lua21
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
+