From: Remi Gacogne Date: Wed, 12 Jul 2023 12:40:34 +0000 (+0200) Subject: dnsdist: Fix timeout handling for incoming H2 w/ nghttp2 X-Git-Tag: rec-5.0.0-alpha1~19^2~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0b324960cd299e0ea6f162dfa7778f6fac134690;p=thirdparty%2Fpdns.git dnsdist: Fix timeout handling for incoming H2 w/ nghttp2 --- diff --git a/pdns/dnsdist-tcp.cc b/pdns/dnsdist-tcp.cc index 8d10e49257..08ecf1d4fc 100644 --- a/pdns/dnsdist-tcp.cc +++ b/pdns/dnsdist-tcp.cc @@ -1361,6 +1361,16 @@ static void tcpClientThread(pdns::channel::Receiver&& queryRecei state->handleTimeout(state, false); } } +#ifdef HAVE_NGHTTP2 + else if (cbData.second.type() == typeid(std::shared_ptr)) { + auto state = boost::any_cast>(cbData.second); + if (cbData.first == state->d_handler.getDescriptor()) { + vinfolog("Timeout (read) from remote H2 client %s", state->d_ci.remote.toStringWithPort()); + std::shared_ptr parentState = state; + state->handleTimeout(parentState, false); + } + } +#endif /* HAVE_NGHTTP2 */ else if (cbData.second.type() == typeid(std::shared_ptr)) { auto conn = boost::any_cast>(cbData.second); vinfolog("Timeout (read) from remote backend %s", conn->getBackendName()); @@ -1377,6 +1387,16 @@ static void tcpClientThread(pdns::channel::Receiver&& queryRecei state->handleTimeout(state, true); } } +#ifdef HAVE_NGHTTP2 + else if (cbData.second.type() == typeid(std::shared_ptr)) { + auto state = boost::any_cast>(cbData.second); + if (cbData.first == state->d_handler.getDescriptor()) { + vinfolog("Timeout (write) from remote H2 client %s", state->d_ci.remote.toStringWithPort()); + std::shared_ptr parentState = state; + state->handleTimeout(parentState, true); + } + } +#endif /* HAVE_NGHTTP2 */ else if (cbData.second.type() == typeid(std::shared_ptr)) { auto conn = boost::any_cast>(cbData.second); vinfolog("Timeout (write) from remote backend %s", conn->getBackendName()); @@ -1407,6 +1427,12 @@ static void tcpClientThread(pdns::channel::Receiver&& queryRecei auto state = boost::any_cast>(param); errlog(" - %s", state->toString()); } +#ifdef HAVE_NGHTTP2 + else if (param.type() == typeid(std::shared_ptr)) { + auto state = boost::any_cast>(param); + errlog(" - %s", state->toString()); + } +#endif /* HAVE_NGHTTP2 */ else if (param.type() == typeid(std::shared_ptr)) { auto conn = boost::any_cast>(param); errlog(" - %s", conn->toString()); @@ -1506,7 +1532,7 @@ static void acceptNewConnection(const TCPAcceptorParam& param, TCPClientThreadDa gettimeofday(&now, nullptr); if (ci.cs->dohFrontend) { -#ifdef HAVE_NGHTTP2 +#ifdef HAVE_NGHTTP2 auto state = std::make_shared(std::move(ci), *threadData, now); state->handleIO(); #endif /* HAVE_NGHTTP2 */