# HG changeset patch # User Kim Alvefur # Date 1553450333 -3600 # Node ID 7d78b24d844999821e15bc0be74d788b70511632 # Parent 601f9781a605a51346aea5683ce11c82a359150b mod_csi_simple: Trigger buffer flush on seeing incoming data I.e. the client sent us something, which means its network / radio is active. diff -r 601f9781a605 -r 7d78b24d8449 plugins/mod_csi_simple.lua --- a/plugins/mod_csi_simple.lua Sun Mar 24 18:33:38 2019 +0100 +++ b/plugins/mod_csi_simple.lua Sun Mar 24 18:58:53 2019 +0100 @@ -104,11 +104,17 @@ 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 @@ 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);