mod_s2s_keepalive: Isolate source host of pings
authorKim Alvefur <zash@zash.se>
Mon, 23 Dec 2019 01:18:02 +0100
changeset 3776 22f02716819f
parent 3775 98e1e3ce307d
child 3777 915c7bd5f754
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.
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 " ";