Comparison

mod_smacks/mod_smacks.lua @ 2727:91cbeb6ad987

mod_smacks: don't send out <r> when already hibernating
author tmolitor <thilo@eightysoft.de>
date Fri, 14 Jul 2017 18:06:17 +0200
parent 2713:eea1d5bac451
child 2744:f70c02c14161
comparison
equal deleted inserted replaced
2726:55f3ab952d06 2727:91cbeb6ad987
150 end 150 end
151 end); 151 end);
152 152
153 local function request_ack_if_needed(session, force) 153 local function request_ack_if_needed(session, force)
154 local queue = session.outgoing_stanza_queue; 154 local queue = session.outgoing_stanza_queue;
155 if session.awaiting_ack == nil then 155 if session.awaiting_ack == nil and not session.hibernating then
156 if (#queue > max_unacked_stanzas and session.last_queue_count ~= #queue) or force then 156 if (#queue > max_unacked_stanzas and session.last_queue_count ~= #queue) or force then
157 session.log("debug", "Queuing <r> (in a moment)"); 157 session.log("debug", "Queuing <r> (in a moment)");
158 session.awaiting_ack = false; 158 session.awaiting_ack = false;
159 session.awaiting_ack_timer = stoppable_timer(1e-06, function () 159 session.awaiting_ack_timer = stoppable_timer(1e-06, function ()
160 if not session.awaiting_ack then 160 if not session.awaiting_ack and not session.hibernating then
161 session.log("debug", "Sending <r> (inside timer, before send)"); 161 session.log("debug", "Sending <r> (inside timer, before send)");
162 (session.sends2s or session.send)(st.stanza("r", { xmlns = session.smacks })) 162 (session.sends2s or session.send)(st.stanza("r", { xmlns = session.smacks }))
163 session.log("debug", "Sending <r> (inside timer, after send)"); 163 session.log("debug", "Sending <r> (inside timer, after send)");
164 session.awaiting_ack = true; 164 session.awaiting_ack = true;
165 if not session.delayed_ack_timer then 165 if not session.delayed_ack_timer then