Software /
code /
prosody-modules
Changeset
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 |
parents | 2147:ed2bb50d4f91 |
children | 2149:d9e91240a2dd |
files | mod_smacks/mod_smacks.lua |
diffstat | 1 files changed, 3 insertions(+), 2 deletions(-) [+] |
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