Changeset

4629:0e60ce83205c

mod_s2s_keepalive: Ignore errors from the local server If a stanza can't be delivered and instead an bounce is generated, the origin of the error, when different from the stanza 'from' should be indicated in the 'by' attribute of the <error>, which we look for here so this doesn't count as a successful ping. An error that does come from the remote means we have connectivity, but probably no XEP-0199 handling. This is fine. We care about connectivity, not protocol.
author Kim Alvefur <zash@zash.se>
date Wed, 21 Jul 2021 15:57:13 +0200
parents 4628:15c4eabdcea0
children 4630:635907a5d2c8
files mod_s2s_keepalive/mod_s2s_keepalive.lua
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mod_s2s_keepalive/mod_s2s_keepalive.lua	Wed Jul 21 15:52:12 2021 +0200
+++ b/mod_s2s_keepalive/mod_s2s_keepalive.lua	Wed Jul 21 15:57:13 2021 +0200
@@ -70,6 +70,13 @@
 	if not (stanza.attr.id and stanza.attr.id:sub(1, #"keepalive:") == "keepalive:") then
 		return -- not a reply to this module
 	end
+	if stanza.attr.type == "error" then
+		local err = stanza:get_child("error");
+		local err_by = err and err.attr.by;
+		if err_by and prosody.hosts[err_by] then
+			return -- error produced by the local host
+		end
+	end
 
 	local origin = event.origin;
 	if origin.dummy then return end -- Probably a sendq bounce