# HG changeset patch # User Kim Alvefur # Date 1615915854 -3600 # Node ID f0f7b0c61465e25afdc47c45007781d3a3d4028d # Parent 751bdd41291599ba51fba3abcec690fe35b3cbb4 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. diff -r 751bdd412915 -r f0f7b0c61465 plugins/mod_s2s.lua --- 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