mod_csi_simple: Try not to flush buffer while already flushing it

Reduces log noice
This commit is contained in:
Kim Alvefur 2019-10-05 16:50:41 +02:00
parent 72b4209cfb
commit 1356b90c3a

View file

@ -75,6 +75,10 @@ local function manage_buffer(stanza, session)
end
local function flush_buffer(data, session)
if session.csi_flushing then
return data;
end
session.csi_flushing = true;
session.log("debug", "Client sent something, flushing buffer once (queue size is %d)", session.csi_counter);
session.conn:resume_writes();
return data;
@ -92,6 +96,7 @@ end
function disable_optimizations(session)
if session.conn and session.conn.resume_writes then
session.csi_flushing = nil;
filters.remove_filter(session, "stanzas/out", manage_buffer);
filters.remove_filter(session, "bytes/in", flush_buffer);
session.conn:resume_writes();