mirror of
https://github.com/bjc/prosody.git
synced 2025-04-04 21:57:45 +03:00
mod_csi_simple: Set session state to 'flushing' while doing so
May be useful for 3rd party modules.
This commit is contained in:
parent
8d7ae33eef
commit
dcab373f45
1 changed files with 3 additions and 1 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue