mod_s2s_keepalive: Isolate source host of pings
The incoming_s2s table is not restricted to the current virtualhost so
this prevents opening more connections than what's needed.
Also prevents useless double sending of one whitespace per local host.
--- a/mod_s2s_keepalive/mod_s2s_keepalive.lua Mon Dec 23 01:12:10 2019 +0100
+++ b/mod_s2s_keepalive/mod_s2s_keepalive.lua Mon Dec 23 01:18:02 2019 +0100
@@ -22,6 +22,7 @@
for session in pairs(prosody.incoming_s2s) do
if session.type ~= "s2sin_unauthed"
+ and session.to_host == host
and (not(keepalive_servers) or keepalive_servers:contains(session.from_host)) then
if not s2sout[session.from_host] then ping_hosts[session.from_host] = true; end
session.sends2s " ";