Software /
code /
prosody
Comparison
plugins/mod_csi_simple.lua @ 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 |
parent | 10277:45a58127a3e5 |
child | 10303:c434bff22b14 |
comparison
equal
deleted
inserted
replaced
10301:3123a13cf577 | 10302:4c53e58d2468 |
---|---|
73 session.csi_counter = ctr + 1; | 73 session.csi_counter = ctr + 1; |
74 return stanza; | 74 return stanza; |
75 end | 75 end |
76 | 76 |
77 local function flush_buffer(data, session) | 77 local function flush_buffer(data, session) |
78 if session.csi_flushing then | |
79 return data; | |
80 end | |
81 session.csi_flushing = true; | |
78 session.log("debug", "Client sent something, flushing buffer once (queue size is %d)", session.csi_counter); | 82 session.log("debug", "Client sent something, flushing buffer once (queue size is %d)", session.csi_counter); |
79 session.conn:resume_writes(); | 83 session.conn:resume_writes(); |
80 return data; | 84 return data; |
81 end | 85 end |
82 | 86 |
90 end | 94 end |
91 end | 95 end |
92 | 96 |
93 function disable_optimizations(session) | 97 function disable_optimizations(session) |
94 if session.conn and session.conn.resume_writes then | 98 if session.conn and session.conn.resume_writes then |
99 session.csi_flushing = nil; | |
95 filters.remove_filter(session, "stanzas/out", manage_buffer); | 100 filters.remove_filter(session, "stanzas/out", manage_buffer); |
96 filters.remove_filter(session, "bytes/in", flush_buffer); | 101 filters.remove_filter(session, "bytes/in", flush_buffer); |
97 session.conn:resume_writes(); | 102 session.conn:resume_writes(); |
98 end | 103 end |
99 end | 104 end |