From 0c57e44fd3fb98a07eac80ab73bcc7d69cd79a2f Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Fri, 17 Dec 2021 17:22:27 +0100 Subject: mod_smacks: Remove useless delay in requesting ack on resumption Was this the last place using the delay? Nice! --- plugins/mod_smacks.lua | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) (limited to 'plugins') diff --git a/plugins/mod_smacks.lua b/plugins/mod_smacks.lua index f2335cbc..204b3873 100644 --- a/plugins/mod_smacks.lua +++ b/plugins/mod_smacks.lua @@ -144,28 +144,6 @@ local function request_ack_now_if_needed(session, force, reason) end end -local function request_ack_if_needed(session, force, reason, stanza) - if should_ack(session, force) then - timer.add_task(0, function () - request_ack_now_if_needed(session, force, reason, stanza); - 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). - local queue = session.outgoing_stanza_queue; - local max_unacked = max_unacked_stanzas; - if session.state == "inactive" then - max_unacked = max_inactive_unacked_stanzas; - end - if queue:count_unacked() > max_unacked and session.awaiting_ack and session.delayed_ack_timer == nil then - session.log("debug", "Calling ack_delayed directly (still waiting for ack)"); - ack_delayed(session, stanza); -- this is the only new stanza in the queue --> provide it to other modules - end -end - local function outgoing_stanza_filter(stanza, session) -- XXX: Normally you wouldn't have to check the xmlns for a stanza as it's -- supposed to be nil. @@ -591,7 +569,7 @@ function handle_resume(session, stanza, xmlns_sm) end module:fire_event("smacks-hibernation-end", {origin = session, resumed = original_session, queue = queue:table()}); original_session.awaiting_ack = nil; -- Don't wait for acks from before the resumption - request_ack_if_needed(original_session, true, "handle_resume", nil); + request_ack_now_if_needed(original_session, true, "handle_resume", nil); end return true; end -- cgit v1.2.3