aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2022-06-12 01:50:33 +0200
committerKim Alvefur <zash@zash.se>2022-06-12 01:50:33 +0200
commitbfe2a924f83627053681668fb49f98520906c5bb (patch)
tree9d484a37f8f576b5780f063eedac99851b17db3a
parent92874f8eb099851d5c30c802ce486824c03fb91b (diff)
downloadprosody-bfe2a924f83627053681668fb49f98520906c5bb.tar.gz
prosody-bfe2a924f83627053681668fb49f98520906c5bb.zip
mod_smacks: Fix #1761 by setting a flag earlier
This ensures that the flag is set even if the pre-drain callback is called from send(), as would be the case if opportunistic writes are enabled.
-rw-r--r--plugins/mod_smacks.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/plugins/mod_smacks.lua b/plugins/mod_smacks.lua
index 35ea0e4f..3a4c7b84 100644
--- a/plugins/mod_smacks.lua
+++ b/plugins/mod_smacks.lua
@@ -156,9 +156,9 @@ end
local function request_ack(session, reason)
local queue = session.outgoing_stanza_queue;
session.log("debug", "Sending <r> (inside timer, before send) from %s - #queue=%d", reason, queue:count_unacked());
+ session.awaiting_ack = true;
(session.sends2s or session.send)(st.stanza("r", { xmlns = session.smacks }))
if session.destroyed then return end -- sending something can trigger destruction
- session.awaiting_ack = true;
-- expected_h could be lower than this expression e.g. more stanzas added to the queue meanwhile)
session.last_requested_h = queue:count_acked() + queue:count_unacked();
session.log("debug", "Sending <r> (inside timer, after send) from %s - #queue=%d", reason, queue:count_unacked());