aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_csi_simple.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-02-16 23:09:51 +0100
committerKim Alvefur <zash@zash.se>2021-02-16 23:09:51 +0100
commitdcab373f45c5304aa683db64fc5fa5529e680b23 (patch)
tree7388651f8a47b8de310472a13e726c4f8d1c831c /plugins/mod_csi_simple.lua
parent8d7ae33eef51e1821da56d576e73f5c5665029b2 (diff)
downloadprosody-dcab373f45c5304aa683db64fc5fa5529e680b23.tar.gz
prosody-dcab373f45c5304aa683db64fc5fa5529e680b23.zip
mod_csi_simple: Set session state to 'flushing' while doing so
May be useful for 3rd party modules.
Diffstat (limited to 'plugins/mod_csi_simple.lua')
-rw-r--r--plugins/mod_csi_simple.lua4
1 files changed, 3 insertions, 1 deletions
diff --git a/plugins/mod_csi_simple.lua b/plugins/mod_csi_simple.lua
index fed8a8bd..ebe726fe 100644
--- a/plugins/mod_csi_simple.lua
+++ b/plugins/mod_csi_simple.lua
@@ -127,6 +127,7 @@ local function manage_buffer(stanza, session)
flush_reasons[why or "important"]();
session.log("debug", "Flushing buffer (%s; queue size is %d)", why or "important", session.csi_counter);
session.conn:resume_writes();
+ session.state = "flushing";
else
session.log("debug", "Holding buffer (%s; queue size is %d)", why or "unimportant", session.csi_counter);
stanza = with_timestamp(stanza, jid.join(session.username, session.host))
@@ -188,7 +189,8 @@ end, 1);
module:hook("c2s-ondrain", function (event)
local session = event.session;
- if session.state == "inactive" and session.conn and session.conn.pause_writes then
+ if (session.state == "flushing" or session.state == "inactive") and session.conn and session.conn.pause_writes then
+ session.state = "inactive";
session.conn:pause_writes();
session.csi_measure_buffer_hold = measure_buffer_hold();
session.log("debug", "Buffer flushed, resuming inactive mode (queue size was %d)", session.csi_counter);