154 end |
154 end |
155 |
155 |
156 local function request_ack(session, reason) |
156 local function request_ack(session, reason) |
157 local queue = session.outgoing_stanza_queue; |
157 local queue = session.outgoing_stanza_queue; |
158 session.log("debug", "Sending <r> (inside timer, before send) from %s - #queue=%d", reason, queue:count_unacked()); |
158 session.log("debug", "Sending <r> (inside timer, before send) from %s - #queue=%d", reason, queue:count_unacked()); |
|
159 session.awaiting_ack = true; |
159 (session.sends2s or session.send)(st.stanza("r", { xmlns = session.smacks })) |
160 (session.sends2s or session.send)(st.stanza("r", { xmlns = session.smacks })) |
160 if session.destroyed then return end -- sending something can trigger destruction |
161 if session.destroyed then return end -- sending something can trigger destruction |
161 session.awaiting_ack = true; |
|
162 -- expected_h could be lower than this expression e.g. more stanzas added to the queue meanwhile) |
162 -- expected_h could be lower than this expression e.g. more stanzas added to the queue meanwhile) |
163 session.last_requested_h = queue:count_acked() + queue:count_unacked(); |
163 session.last_requested_h = queue:count_acked() + queue:count_unacked(); |
164 session.log("debug", "Sending <r> (inside timer, after send) from %s - #queue=%d", reason, queue:count_unacked()); |
164 session.log("debug", "Sending <r> (inside timer, after send) from %s - #queue=%d", reason, queue:count_unacked()); |
165 if not session.delayed_ack_timer then |
165 if not session.delayed_ack_timer then |
166 session.delayed_ack_timer = timer.add_task(delayed_ack_timeout, function() |
166 session.delayed_ack_timer = timer.add_task(delayed_ack_timeout, function() |