Diff

plugins/mod_s2s.lua @ 11742:9c450185bac1

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.
author Kim Alvefur <zash@zash.se>
date Mon, 16 Aug 2021 12:45:14 +0200
parent 11740:b92f2abe0bda
child 11770:d2a9aa1c7ac8
line wrap: on
line diff
--- a/plugins/mod_s2s.lua	Mon Aug 16 12:34:52 2021 +0200
+++ b/plugins/mod_s2s.lua	Mon Aug 16 12:45:14 2021 +0200
@@ -860,6 +860,13 @@
 	end
 end
 
+function listener.onpredrain(conn)
+	local session = sessions[conn];
+	if session then
+		return (hosts[session.host] or prosody).events.fire_event("s2s-pre-ondrain", { session = session });
+	end
+end
+
 function listener.register_outgoing(conn, session)
 	sessions[conn] = session;
 	initialize_session(session);