Mercurial > prosody-modules
diff mod_smacks/mod_smacks.lua @ 2713:eea1d5bac451
mod_smacks: Fix delayed_ack event
After the first delayed ack every queued stanza should immediately
trigger the delayed_ack event.
author | tmolitor <thilo@eightysoft.de> |
---|---|
date | Mon, 08 May 2017 19:36:37 +0200 |
parents | d96831e46b64 |
children | 91cbeb6ad987 |
line wrap: on
line diff
--- 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