diff 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
parents eea1d5bac451
children f70c02c14161
line wrap: on
line diff
--- a/mod_smacks/mod_smacks.lua	Thu Jul 06 10:48:39 2017 +0100
+++ b/mod_smacks/mod_smacks.lua	Fri Jul 14 18:06:17 2017 +0200
@@ -152,12 +152,12 @@
 
 local function request_ack_if_needed(session, force)
 	local queue = session.outgoing_stanza_queue;
-	if session.awaiting_ack == nil then
+	if session.awaiting_ack == nil and not session.hibernating then
 		if (#queue > max_unacked_stanzas and session.last_queue_count ~= #queue) or force then
 			session.log("debug", "Queuing <r> (in a moment)");
 			session.awaiting_ack = false;
 			session.awaiting_ack_timer = stoppable_timer(1e-06, function ()
-				if not session.awaiting_ack then
+				if not session.awaiting_ack and not session.hibernating then
 					session.log("debug", "Sending <r> (inside timer, before send)");
 					(session.sends2s or session.send)(st.stanza("r", { xmlns = session.smacks }))
 					session.log("debug", "Sending <r> (inside timer, after send)");