diff options
author | Kim Alvefur <zash@zash.se> | 2019-03-24 18:58:53 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2019-03-24 18:58:53 +0100 |
commit | 439a1e0ebb1045d72b0a3c106dc1d122783387e2 (patch) | |
tree | 089e42139e0c9cb4337eb44a5ec448f476f8f499 /plugins | |
parent | 00f3e4db9c96b7939c1cf87c514a40f58ae7fde0 (diff) | |
download | prosody-439a1e0ebb1045d72b0a3c106dc1d122783387e2.tar.gz prosody-439a1e0ebb1045d72b0a3c106dc1d122783387e2.zip |
mod_csi_simple: Trigger buffer flush on seeing incoming data
I.e. the client sent us something, which means its network / radio is
active.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mod_csi_simple.lua | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/plugins/mod_csi_simple.lua b/plugins/mod_csi_simple.lua index 5c829179..07a8cfb3 100644 --- a/plugins/mod_csi_simple.lua +++ b/plugins/mod_csi_simple.lua @@ -104,11 +104,17 @@ local function manage_buffer(stanza, session) return stanza; end +local function flush_buffer(data, session) + session.conn:resume_writes(); + 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.conn:pause_writes(); filters.add_filter(session, "stanzas/out", manage_buffer); + filters.add_filter(session, "bytes/in", flush_buffer); elseif session.pump then session.pump:pause(); else @@ -136,6 +142,7 @@ module:hook("csi-client-active", function (event) session.pump:resume(); elseif session.conn and session.conn and session.conn.resume_writes then filters.remove_filter(session, "stanzas/out", manage_buffer); + filters.remove_filter(session, "bytes/in", flush_buffer); session.conn:resume_writes(); end end); |