Changeset

10302:4c53e58d2468

mod_csi_simple: Try not to flush buffer while already flushing it Reduces log noice
author Kim Alvefur <zash@zash.se>
date Sat, 05 Oct 2019 16:50:41 +0200
parents 10301:3123a13cf577
children 10303:c434bff22b14
files plugins/mod_csi_simple.lua
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_csi_simple.lua	Sat Oct 05 16:21:41 2019 +0200
+++ b/plugins/mod_csi_simple.lua	Sat Oct 05 16:50:41 2019 +0200
@@ -75,6 +75,10 @@
 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 @@
 
 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();