diff options
author | Kim Alvefur <zash@zash.se> | 2021-08-16 12:45:14 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2021-08-16 12:45:14 +0200 |
commit | 48216c1dc849292323b016660e851f58aae2e325 (patch) | |
tree | f67338c752bace5fbd37855a37973d425037890e /plugins/mod_c2s.lua | |
parent | d06ae1629513e0a8ab8c1a24566226dddc93e8e1 (diff) | |
download | prosody-48216c1dc849292323b016660e851f58aae2e325.tar.gz prosody-48216c1dc849292323b016660e851f58aae2e325.zip |
mod_c2s,mod_s2s: Fire event just before writes
Could allow e.g. a XEP-0198 implementation to efficiently send ack
requests at optimal times without using timers or nextTick.
Diffstat (limited to 'plugins/mod_c2s.lua')
-rw-r--r-- | plugins/mod_c2s.lua | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/plugins/mod_c2s.lua b/plugins/mod_c2s.lua index 722932f6..8bd28782 100644 --- a/plugins/mod_c2s.lua +++ b/plugins/mod_c2s.lua @@ -393,6 +393,13 @@ function listener.ondrain(conn) end end +function listener.onpredrain(conn) + local session = sessions[conn]; + if session then + return (hosts[session.host] or prosody).events.fire_event("c2s-pre-ondrain", { session = session }); + end +end + local function keepalive(event) local session = event.session; if not session.notopen then |