# HG changeset patch # User tmolitor # Date 1494264997 -7200 # Node ID eea1d5bac45137cc6e66578e42e2892509ce321c # Parent d89ab70808f6eb83c25e010b92b97c69232f8e5e mod_smacks: Fix delayed_ack event After the first delayed ack every queued stanza should immediately trigger the delayed_ack event. diff -r d89ab70808f6 -r eea1d5bac451 mod_smacks/mod_smacks.lua --- a/mod_smacks/mod_smacks.lua Mon May 08 18:24:29 2017 +0200 +++ b/mod_smacks/mod_smacks.lua Mon May 08 19:36:37 2017 +0200 @@ -170,15 +170,17 @@ end end); end - -- Trigger "smacks-ack-delayed"-event if we added new (ackable) stanzas to the outgoing queue - -- 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 - session.log("debug", "Calling delayed_ack_function directly (still waiting for ack)"); - delayed_ack_function(session); - end end + + -- Trigger "smacks-ack-delayed"-event if we added new (ackable) stanzas to the outgoing queue + -- 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 + session.log("debug", "Calling delayed_ack_function directly (still waiting for ack)"); + delayed_ack_function(session); + end + session.last_queue_count = #queue; end