Mercurial > prosody-modules
comparison mod_s2s_keepalive/mod_s2s_keepalive.lua @ 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 | 15c4eabdcea0 |
children |
comparison
equal
deleted
inserted
replaced
4628:15c4eabdcea0 | 4629:0e60ce83205c |
---|---|
68 return -- not a reply iq stanza | 68 return -- not a reply iq stanza |
69 end | 69 end |
70 if not (stanza.attr.id and stanza.attr.id:sub(1, #"keepalive:") == "keepalive:") then | 70 if not (stanza.attr.id and stanza.attr.id:sub(1, #"keepalive:") == "keepalive:") then |
71 return -- not a reply to this module | 71 return -- not a reply to this module |
72 end | 72 end |
73 if stanza.attr.type == "error" then | |
74 local err = stanza:get_child("error"); | |
75 local err_by = err and err.attr.by; | |
76 if err_by and prosody.hosts[err_by] then | |
77 return -- error produced by the local host | |
78 end | |
79 end | |
73 | 80 |
74 local origin = event.origin; | 81 local origin = event.origin; |
75 if origin.dummy then return end -- Probably a sendq bounce | 82 if origin.dummy then return end -- Probably a sendq bounce |
76 if origin.watchdog_keepalive then | 83 if origin.watchdog_keepalive then |
77 origin.log("debug", "Resetting keepalive watchdog") | 84 origin.log("debug", "Resetting keepalive watchdog") |