mod_smacks: Fix delayed_ack event

Mon, 08 May 2017 19:36:37 +0200

author
tmolitor <thilo@eightysoft.de>
date
Mon, 08 May 2017 19:36:37 +0200
changeset 2713
eea1d5bac451
parent 2712
d89ab70808f6
child 2714
75b137cf869a

mod_smacks: Fix delayed_ack event

After the first delayed ack every queued stanza should immediately
trigger the delayed_ack event.

mod_smacks/mod_smacks.lua file | annotate | diff | comparison | revisions
--- 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
 

mercurial