aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_csi_simple.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2019-03-24 19:02:40 +0100
committerKim Alvefur <zash@zash.se>2019-03-24 19:02:40 +0100
commit461c69ff4eca9672bac066cb7f14fdc98bdae32b (patch)
tree71f3473f87f8a10bc74f73db3557e111f2087c94 /plugins/mod_csi_simple.lua
parent439a1e0ebb1045d72b0a3c106dc1d122783387e2 (diff)
downloadprosody-461c69ff4eca9672bac066cb7f14fdc98bdae32b.tar.gz
prosody-461c69ff4eca9672bac066cb7f14fdc98bdae32b.zip
mod_csi_simple: Also flush buffer in "pump" mode
Diffstat (limited to 'plugins/mod_csi_simple.lua')
-rw-r--r--plugins/mod_csi_simple.lua7
1 files changed, 7 insertions, 0 deletions
diff --git a/plugins/mod_csi_simple.lua b/plugins/mod_csi_simple.lua
index 07a8cfb3..ee7e01c9 100644
--- a/plugins/mod_csi_simple.lua
+++ b/plugins/mod_csi_simple.lua
@@ -109,9 +109,15 @@ local function flush_buffer(data, session)
return data;
end
+local function flush_pump(data, session)
+ session.pump:flush();
+ return data;
+end
+
module:hook("csi-client-inactive", function (event)
local session = event.origin;
if session.conn and session.conn and session.conn.pause_writes then
+ session.log("info", "Native net.server buffer management mode");
session.conn:pause_writes();
filters.add_filter(session, "stanzas/out", manage_buffer);
filters.add_filter(session, "bytes/in", flush_buffer);
@@ -124,6 +130,7 @@ module:hook("csi-client-inactive", function (event)
local pump = new_pump(session.send, queue_size);
pump:pause();
session.pump = pump;
+ filters.add_filter(session, "bytes/in", flush_pump);
function session.send(stanza)
if session.state == "active" or module:fire_event("csi-is-stanza-important", { stanza = stanza, session = session }) then
pump:flush();