diff mod_smacks/mod_smacks.lua @ 2136:f1be45c9a742

mod_smacks: Prevent queuing multiple <r>
author Kim Alvefur <zash@zash.se>
date Mon, 21 Mar 2016 14:08:03 +0100
parents 3f788f18cc10
children 3a94b3cd31e2
line wrap: on
line diff
--- a/mod_smacks/mod_smacks.lua	Mon Mar 21 13:18:04 2016 +0100
+++ b/mod_smacks/mod_smacks.lua	Mon Mar 21 14:08:03 2016 +0100
@@ -89,9 +89,9 @@
 		end
 		if #queue > max_unacked_stanzas and not session.awaiting_ack then
 			session.log("debug", "Queuing <r> (in a moment)");
+			session.awaiting_ack = true;
 			session.awaiting_ack_timer = module:add_timer(1e-06, function ()
 				if not session.awaiting_ack then
-					session.awaiting_ack = true;
 					session.log("debug", "Sending <r> (after send)");
 					(session.sends2s or session.send)(st.stanza("r", { xmlns = session.smacks }))
 				end