From: Remi Gacogne Date: Mon, 28 Jul 2025 14:33:46 +0000 (+0200) Subject: dnsdist: Stop reading on incoming DoH sockets if we are done X-Git-Tag: dnsdist-2.0.1~10^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=98ba61ee4034ba21f286126b168ee1ca2d7b547f;p=thirdparty%2Fpdns.git dnsdist: Stop reading on incoming DoH sockets if we are done If the underlying library doesn't want to read, we have nothing to send at the moment, but we are still waiting for responses, there is no need to keep polling the socket. Signed-off-by: Remi Gacogne (cherry picked from commit e0a5a6dc4ab9557442ddbba56d03f6e4fb132bf2) --- diff --git a/pdns/dnsdistdist/dnsdist-nghttp2-in.cc b/pdns/dnsdistdist/dnsdist-nghttp2-in.cc index 56d6c52a85..3cc0451506 100644 --- a/pdns/dnsdistdist/dnsdist-nghttp2-in.cc +++ b/pdns/dnsdistdist/dnsdist-nghttp2-in.cc @@ -443,6 +443,24 @@ void IncomingHTTP2Connection::handleIO() if (nghttp2_session_want_read(d_session.get()) != 0) { updateIO(IOState::NeedRead, handleReadableIOCallback); } + else { + if (getConcurrentStreamsCount() == 0) { + d_connectionDied = true; + stopIO(); + } + else { + updateIO(IOState::Done, handleReadableIOCallback); + } + } + } + else { + if (getConcurrentStreamsCount() == 0) { + d_connectionDied = true; + stopIO(); + } + else { + updateIO(IOState::Done, handleReadableIOCallback); + } } } catch (const std::exception& e) { @@ -1263,6 +1281,9 @@ void IncomingHTTP2Connection::updateIO(IOState newState, const FDMultiplexer::ca ttd = getClientWriteTTD(now); d_ioState->update(newState, callback, shared, ttd); } + else if (newState == IOState::Done) { + d_ioState->reset(); + } } void IncomingHTTP2Connection::handleIOError()