# HG changeset patch # User Kim Alvefur # Date 1637066389 -3600 # Node ID e227af6297368cb810e29a0be36492fedfd723a1 # Parent 6ca2769da62a1a008215df0f10e6a3a89da58bc8 mod_smacks: Send immediately from csi-flushing event Using a timer serves no purpose in this case, only serves to increase the number of write syscalls and TCP segments sent. diff -r 6ca2769da62a -r e227af629736 mod_smacks/mod_smacks.lua --- a/mod_smacks/mod_smacks.lua Mon Nov 15 15:29:02 2021 +0000 +++ b/mod_smacks/mod_smacks.lua Tue Nov 16 13:39:49 2021 +0100 @@ -650,9 +650,14 @@ end end); -module:hook("csi-flushing", function (event) - if event.session.smacks then - request_ack_if_needed(event.session, true, "csi-active", nil); +module:hook("csi-flushing", function(event) + local session = event.session; + if session.smacks then + if not session.awaiting_ack and not session.hibernating and not session.destroyed then + session.log("debug", "Sending (csi-flushing)"); + session.awaiting_ack = true; -- The send() call may invoke this event again, so set this first + (session.sends2s or session.send)(st.stanza("r", { xmlns = session.smacks })) + end end end);