Mercurial > prosody-modules
comparison mod_s2s_keepalive/mod_s2s_keepalive.lua @ 3772:22f02716819f
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.
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Mon, 23 Dec 2019 01:18:02 +0100 |
| parents | 98e1e3ce307d |
| children | 580862decd77 |
comparison
equal
deleted
inserted
replaced
| 3771:98e1e3ce307d | 3772:22f02716819f |
|---|---|
| 20 end | 20 end |
| 21 end | 21 end |
| 22 | 22 |
| 23 for session in pairs(prosody.incoming_s2s) do | 23 for session in pairs(prosody.incoming_s2s) do |
| 24 if session.type ~= "s2sin_unauthed" | 24 if session.type ~= "s2sin_unauthed" |
| 25 and session.to_host == host | |
| 25 and (not(keepalive_servers) or keepalive_servers:contains(session.from_host)) then | 26 and (not(keepalive_servers) or keepalive_servers:contains(session.from_host)) then |
| 26 if not s2sout[session.from_host] then ping_hosts[session.from_host] = true; end | 27 if not s2sout[session.from_host] then ping_hosts[session.from_host] = true; end |
| 27 session.sends2s " "; | 28 session.sends2s " "; |
| 28 -- If the connection is dead, this should make it time out. | 29 -- If the connection is dead, this should make it time out. |
| 29 end | 30 end |
