# HG changeset patch
# User Kim Alvefur <zash@zash.se>
# Date 1577060282 -3600
# Node ID 22f02716819f9cba3827b03b7f2caf401eacc81d
# Parent  98e1e3ce307de4d70ae254969a9df0a9c1dc9095
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.

diff -r 98e1e3ce307d -r 22f02716819f mod_s2s_keepalive/mod_s2s_keepalive.lua
--- 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 " ";