Software /
code /
prosody-modules
Comparison
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 |
parent | 2122:3f788f18cc10 |
child | 2140:3a94b3cd31e2 |
comparison
equal
deleted
inserted
replaced
2135:42b095dab626 | 2136:f1be45c9a742 |
---|---|
87 session.log("debug", "hibernating, stanza queued"); | 87 session.log("debug", "hibernating, stanza queued"); |
88 return nil; | 88 return nil; |
89 end | 89 end |
90 if #queue > max_unacked_stanzas and not session.awaiting_ack then | 90 if #queue > max_unacked_stanzas and not session.awaiting_ack then |
91 session.log("debug", "Queuing <r> (in a moment)"); | 91 session.log("debug", "Queuing <r> (in a moment)"); |
92 session.awaiting_ack = true; | |
92 session.awaiting_ack_timer = module:add_timer(1e-06, function () | 93 session.awaiting_ack_timer = module:add_timer(1e-06, function () |
93 if not session.awaiting_ack then | 94 if not session.awaiting_ack then |
94 session.awaiting_ack = true; | |
95 session.log("debug", "Sending <r> (after send)"); | 95 session.log("debug", "Sending <r> (after send)"); |
96 (session.sends2s or session.send)(st.stanza("r", { xmlns = session.smacks })) | 96 (session.sends2s or session.send)(st.stanza("r", { xmlns = session.smacks })) |
97 end | 97 end |
98 end); | 98 end); |
99 end | 99 end |