From d4f4f76c3c703a323a712119e60eb3dbe053cbbd Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Tue, 16 Mar 2021 18:30:54 +0100 Subject: 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. --- plugins/mod_s2s.lua | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'plugins') 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 -- cgit v1.2.3