aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/mod_c2s.lua7
-rw-r--r--plugins/mod_s2s.lua7
2 files changed, 14 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
diff --git a/plugins/mod_s2s.lua b/plugins/mod_s2s.lua
index 75eb15ca..d800138f 100644
--- a/plugins/mod_s2s.lua
+++ b/plugins/mod_s2s.lua
@@ -860,6 +860,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("s2s-pre-ondrain", { session = session });
+ end
+end
+
function listener.register_outgoing(conn, session)
sessions[conn] = session;
initialize_session(session);