comparison mod_smacks/mod_smacks.lua @ 2088:7a29d8e3275b

mod_smacks: Go back to sending ack requests from a timer a moment after a stanza was sent
author Kim Alvefur <zash@zash.se>
date Wed, 16 Mar 2016 13:26:21 +0100
parents e48dbb640408
children 964b3d649a36
comparison
equal deleted inserted replaced
2087:e48dbb640408 2088:7a29d8e3275b
86 if session.hibernating then 86 if session.hibernating then
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.awaiting_ack = true; 91 session.log("debug", "Queuing <r> (in a moment)");
92 return tostring(stanza)..tostring(st.stanza("r", { xmlns = session.smacks })); 92 module:add_timer(1e-06, function ()
93 if not session.awaiting_ack then
94 session.awaiting_ack = true;
95 session.log("debug", "Sending <r> (after send)");
96 (session.sends2s or session.send)(st.stanza("r", { xmlns = session.smacks }))
97 end
98 end);
93 end 99 end
94 end 100 end
95 return stanza; 101 return stanza;
96 end 102 end
97 103