Software /
code /
prosody
Diff
plugins/mod_s2s.lua @ 12807:f0f7b0c61465
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.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 16 Mar 2021 18:30:54 +0100 |
parent | 12806:751bdd412915 |
child | 12808:12bd40b8e105 |
line wrap: on
line diff
--- 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