Software /
code /
prosody
Changeset
9914:2c6b7247c3d9
mod_csi_simple: Also flush buffer in "pump" mode
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 24 Mar 2019 19:02:40 +0100 |
parents | 9913:7d78b24d8449 |
children | 9915:9fe7b18bca15 |
files | plugins/mod_csi_simple.lua |
diffstat | 1 files changed, 7 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_csi_simple.lua Sun Mar 24 18:58:53 2019 +0100 +++ b/plugins/mod_csi_simple.lua Sun Mar 24 19:02:40 2019 +0100 @@ -109,9 +109,15 @@ 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 @@ 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();