comparison mod_s2s_failclose/mod_s2s_failclose.lua @ 6353:83355cfcad1d

mod_s2s_failclose: Report outgoing connection failures to remote servers Plugin form of Prosody trunk rev d4a7cc295363 for earlier versions.
author Kim Alvefur <zash@zash.se>
date Tue, 30 Dec 2025 23:32:50 +0100
parents
children
comparison
equal deleted inserted replaced
6352:525655adfd3e 6353:83355cfcad1d
1 module:set_global();
2 local errors = require "prosody.util.error";
3 local incoming_s2s = prosody.incoming_s2s;
4
5 -- When an outgoing connection fails, close a corresponding incoming connection with a stream error to indicate the problem to the remote
6 module:hook("s2s-destroyed", function(event)
7 local s2sout = event.session;
8 if s2sout.type ~= "s2sout_unauthed" then return end
9 for s2sin in pairs(incoming_s2s) do
10 if s2sin.from_host == s2sout.to_host and s2sin.to_host == s2sout.from_host then
11 s2sin:close(errors.new({ condition = "reset", text = "Could not deliver return stanzas, please check your DNS and firewall" }));
12 end
13 end
14 end);