Comparison

mod_smacks/mod_smacks.lua @ 4442:74da3643c62d

mod_smacks: Don't ask for acks while in (csi) inactive mode The acks count as high priority events in mod_csi_simple and since they're sent after each stanza, it negated all optimizations.
author Kim Alvefur <zash@zash.se>
date Tue, 16 Feb 2021 19:16:21 +0100
parent 4413:0b9501f82e63
child 4444:2f5e52d67928
comparison
equal deleted inserted replaced
4441:58a112bd9792 4442:74da3643c62d
160 160
161 local function request_ack_if_needed(session, force, reason, stanza) 161 local function request_ack_if_needed(session, force, reason, stanza)
162 local queue = session.outgoing_stanza_queue; 162 local queue = session.outgoing_stanza_queue;
163 local expected_h = session.last_acknowledged_stanza + #queue; 163 local expected_h = session.last_acknowledged_stanza + #queue;
164 -- session.log("debug", "*** SMACKS(1) ***: awaiting_ack=%s, hibernating=%s", tostring(session.awaiting_ack), tostring(session.hibernating)); 164 -- session.log("debug", "*** SMACKS(1) ***: awaiting_ack=%s, hibernating=%s", tostring(session.awaiting_ack), tostring(session.hibernating));
165 if session.awaiting_ack == nil and not session.hibernating then 165 if session.awaiting_ack == nil and not session.hibernating and session.state ~= "inactive" then
166 -- this check of last_requested_h prevents ack-loops if missbehaving clients report wrong 166 -- this check of last_requested_h prevents ack-loops if missbehaving clients report wrong
167 -- stanza counts. it is set when an <r> is really sent (e.g. inside timer), preventing any 167 -- stanza counts. it is set when an <r> is really sent (e.g. inside timer), preventing any
168 -- further requests until a higher h-value would be expected. 168 -- further requests until a higher h-value would be expected.
169 -- session.log("debug", "*** SMACKS(2) ***: #queue=%s, max_unacked_stanzas=%s, expected_h=%s, last_requested_h=%s", tostring(#queue), tostring(max_unacked_stanzas), tostring(expected_h), tostring(session.last_requested_h)); 169 -- session.log("debug", "*** SMACKS(2) ***: #queue=%s, max_unacked_stanzas=%s, expected_h=%s, last_requested_h=%s", tostring(#queue), tostring(max_unacked_stanzas), tostring(expected_h), tostring(session.last_requested_h));
170 if (#queue > max_unacked_stanzas and expected_h ~= session.last_requested_h) or force then 170 if (#queue > max_unacked_stanzas and expected_h ~= session.last_requested_h) or force then