Software /
code /
prosody-modules
Diff
mod_smacks/mod_smacks.lua @ 2148:c472a454be61
mod_smacks: Fix sending <r> after stanzas while not creating multiple timers (thanks Thilo)
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 02 Apr 2016 20:03:30 +0200 |
parent | 2140:3a94b3cd31e2 |
child | 2251:48c3d64a3fc1 |
line wrap: on
line diff
--- 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 <r> (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 <r> (after send)"); (session.sends2s or session.send)(st.stanza("r", { xmlns = session.smacks })) + session.awaiting_ack = true; end end); end