# HG changeset patch # User Kim Alvefur # Date 1414531601 -3600 # Node ID 05fa54404012e779e392a31eff5237c4e8527abc # Parent 57bb2497fadc64a5178a297bb8f986d0fba9a030 mod_smacks: Send ack requests by serializing and concatenating them to outgoing stanzas, using a timer might cause high CPU usage diff -r 57bb2497fadc -r 05fa54404012 mod_smacks/mod_smacks.lua --- a/mod_smacks/mod_smacks.lua Tue Oct 28 15:24:50 2014 +0100 +++ b/mod_smacks/mod_smacks.lua Tue Oct 28 22:26:41 2014 +0100 @@ -74,13 +74,9 @@ session.log("debug", "hibernating, stanza queued"); return ""; -- Hack to make session.send() not return nil end - if #queue > max_unacked_stanzas then - module:add_timer(0, function () - if not session.awaiting_ack then - session.awaiting_ack = true; - (session.sends2s or session.send)(st.stanza("r", { xmlns = session.smacks })); - end - end); + if #queue > max_unacked_stanzas and not session.awaiting_ack then + session.awaiting_ack = true; + return tostring(stanza)..tostring(st.stanza("r", { xmlns = session.smacks })); end end return stanza;