From: Remi Gacogne Date: Tue, 21 Jun 2022 15:49:23 +0000 (+0200) Subject: dnsdist: Only put outgoing DoH conn in the idle queue if they are idle X-Git-Tag: auth-4.8.0-alpha0~39^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a34f264a989e0148ec5780b2c004ee68f1d0fafc;p=thirdparty%2Fpdns.git dnsdist: Only put outgoing DoH conn in the idle queue if they are idle --- diff --git a/pdns/dnsdistdist/dnsdist-nghttp2.cc b/pdns/dnsdistdist/dnsdist-nghttp2.cc index 299ad929fd..4288dc95a0 100644 --- a/pdns/dnsdistdist/dnsdist-nghttp2.cc +++ b/pdns/dnsdistdist/dnsdist-nghttp2.cc @@ -466,14 +466,16 @@ void DoHConnectionToBackend::stopIO() { d_ioState->reset(); - auto shared = std::dynamic_pointer_cast(shared_from_this()); - if (!willBeReusable(false)) { - /* remove ourselves from the connection cache, this might mean that our - reference count drops to zero after that, so we need to be careful */ - t_downstreamDoHConnectionsManager.removeDownstreamConnection(shared); - } - else { - t_downstreamDoHConnectionsManager.moveToIdle(shared); + if (isIdle()) { + auto shared = std::dynamic_pointer_cast(shared_from_this()); + if (!willBeReusable(false)) { + /* remove ourselves from the connection cache, this might mean that our + reference count drops to zero after that, so we need to be careful */ + t_downstreamDoHConnectionsManager.removeDownstreamConnection(shared); + } + else { + t_downstreamDoHConnectionsManager.moveToIdle(shared); + } } }