aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2019-03-24 18:58:53 +0100
committerKim Alvefur <zash@zash.se>2019-03-24 18:58:53 +0100
commit141c5d3fbe257cf63249eeec528dd36b3266b25e (patch)
tree089e42139e0c9cb4337eb44a5ec448f476f8f499 /plugins
parent643c317b1627da95e839bab0e397d89ab6f6a589 (diff)
downloadprosody-141c5d3fbe257cf63249eeec528dd36b3266b25e.tar.gz
prosody-141c5d3fbe257cf63249eeec528dd36b3266b25e.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.lua7
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);