Mercurial > prosody-modules
changeset 4771:e227af629736
mod_smacks: Send <r> 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.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 16 Nov 2021 13:39:49 +0100 |
parents | 6ca2769da62a |
children | 85d4ab318d66 |
files | mod_smacks/mod_smacks.lua |
diffstat | 1 files changed, 8 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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 <r> (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);