# HG changeset patch # User Kim Alvefur # Date 1627481163 -7200 # Node ID 242251ce103668bec491f889cb85da2893a24fe3 # Parent 6bcccc63b542b02804ac141005e2495b6c75a64b mod_smacks: Use 'smacks_max_inactive_unacked_stanzas' when inactive and no timer This separate limit should probably apply also when it somehow doesn't have a timer set. diff -r 6bcccc63b542 -r 242251ce1036 mod_smacks/mod_smacks.lua --- a/mod_smacks/mod_smacks.lua Thu Jul 29 17:23:08 2021 +0200 +++ b/mod_smacks/mod_smacks.lua Wed Jul 28 16:06:03 2021 +0200 @@ -163,11 +163,11 @@ local queue = session.outgoing_stanza_queue; local expected_h = session.last_acknowledged_stanza + #queue; -- session.log("debug", "*** SMACKS(1) ***: awaiting_ack=%s, hibernating=%s", tostring(session.awaiting_ack), tostring(session.hibernating)); + local max_unacked = max_unacked_stanzas; + if session.state == "inactive" then + max_unacked = max_inactive_unacked_stanzas; + end if session.awaiting_ack == nil and not session.hibernating then - local max_unacked = max_unacked_stanzas; - if session.state == "inactive" then - max_unacked = max_inactive_unacked_stanzas; - end -- this check of last_requested_h prevents ack-loops if missbehaving clients report wrong -- stanza counts. it is set when an is really sent (e.g. inside timer), preventing any -- further requests until a higher h-value would be expected. @@ -200,7 +200,7 @@ -- and there isn't already a timer for this event running. -- If we wouldn't do this, stanzas added to the queue after the first "smacks-ack-delayed"-event -- would not trigger this event (again). - if #queue > max_unacked_stanzas and session.awaiting_ack and session.delayed_ack_timer == nil then + if #queue > max_unacked and session.awaiting_ack and session.delayed_ack_timer == nil then session.log("debug", "Calling delayed_ack_function directly (still waiting for ack)"); delayed_ack_function(session, stanza); -- this is the only new stanza in the queue --> provide it to other modules end