# HG changeset patch # User Kim Alvefur # Date 1459620210 -7200 # Node ID c472a454be617b19c1989186dabc4bd823919a5b # Parent ed2bb50d4f91c1b1e234c5a84883990cbdc4fb6e mod_smacks: Fix sending after stanzas while not creating multiple timers (thanks Thilo) diff -r ed2bb50d4f91 -r c472a454be61 mod_smacks/mod_smacks.lua --- a/mod_smacks/mod_smacks.lua Fri Apr 01 15:18:56 2016 +0200 +++ b/mod_smacks/mod_smacks.lua Sat Apr 02 20:03:30 2016 +0200 @@ -87,13 +87,14 @@ session.log("debug", "hibernating, stanza queued"); return nil; end - if #queue > max_unacked_stanzas and not session.awaiting_ack then + if #queue > max_unacked_stanzas and session.awaiting_ack == nil then session.log("debug", "Queuing (in a moment)"); - session.awaiting_ack = true; + session.awaiting_ack = false; session.awaiting_ack_timer = module:add_timer(1e-06, function () if not session.awaiting_ack then session.log("debug", "Sending (after send)"); (session.sends2s or session.send)(st.stanza("r", { xmlns = session.smacks })) + session.awaiting_ack = true; end end); end