aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-03-16 18:30:54 +0100
committerKim Alvefur <zash@zash.se>2021-03-16 18:30:54 +0100
commitd4f4f76c3c703a323a712119e60eb3dbe053cbbd (patch)
tree3f00ea8cbb4435dc2a876d16bd09a55f34171898 /plugins
parent6d0298961d6d4150aa43897baa1c40a49dd4992f (diff)
downloadprosody-d4f4f76c3c703a323a712119e60eb3dbe053cbbd.tar.gz
prosody-d4f4f76c3c703a323a712119e60eb3dbe053cbbd.zip
mod_s2s: Avoid sending too large stanzas
Just dropping them isn't great but hopefully something more sensible can be done in the future. Will need work to ensure that this signal is handled correctly in sending modules etc.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_s2s.lua5
1 files changed, 5 insertions, 0 deletions
diff --git a/plugins/mod_s2s.lua b/plugins/mod_s2s.lua
index a8e707a0..afed3575 100644
--- a/plugins/mod_s2s.lua
+++ b/plugins/mod_s2s.lua
@@ -772,6 +772,11 @@ local function initialize_session(session)
end
if t then
t = filter("bytes/out", tostring(t));
+ if session.outgoing_stanza_size_limit and #t > session.outgoing_stanza_size_limit then
+ log("warn", "Attempt to send a stanza exceeding session limit of %dB (%dB)!", session.outgoing_stanza_size_limit, #t);
+ -- TODO Pass identifiable error condition back to allow appropriate handling
+ return false
+ end
if t then
return w(conn, t);
end