From: Otto Date: Tue, 24 Aug 2021 09:25:07 +0000 (+0200) Subject: Only clean on store if over a limit X-Git-Tag: rec-4.6.0-alpha1~2^2~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fc306a5781eb884fc4efd822eada60538992d0ee;p=thirdparty%2Fpdns.git Only clean on store if over a limit --- diff --git a/pdns/recursordist/rec-tcpout.cc b/pdns/recursordist/rec-tcpout.cc index 91a0ef822c..5d05fb596e 100644 --- a/pdns/recursordist/rec-tcpout.cc +++ b/pdns/recursordist/rec-tcpout.cc @@ -49,7 +49,10 @@ void TCPOutConnectionManager::cleanup() void TCPOutConnectionManager::store(const ComboAddress& ip, Connection& connection) { - cleanup(); + if (d_idle_connections.size() >= maxIdlePerThread || d_idle_connections.count(ip) >= maxIdlePerAuth) { + cleanup(); + } + if (d_idle_connections.size() >= maxIdlePerThread) { return; }