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.
--- a/plugins/mod_s2s.lua Tue Mar 16 18:30:34 2021 +0100
+++ b/plugins/mod_s2s.lua Tue Mar 16 18:30:54 2021 +0100
@@ -772,6 +772,11 @@
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