From: Remi Gacogne Date: Tue, 28 Jul 2026 10:22:46 +0000 (+0200) Subject: dnsdist: `nghttp2`'s error callback is "solely for debugging purpose" X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e68fb29a0a894422812e7facb77a5e01bf5029b5;p=thirdparty%2Fpdns.git dnsdist: `nghttp2`'s error callback is "solely for debugging purpose" So there is no need to terminate the stream/session ourselves. Signed-off-by: Remi Gacogne --- diff --git a/pdns/dnsdistdist/dnsdist-nghttp2-in.cc b/pdns/dnsdistdist/dnsdist-nghttp2-in.cc index 1505440702..f092519339 100644 --- a/pdns/dnsdistdist/dnsdist-nghttp2-in.cc +++ b/pdns/dnsdistdist/dnsdist-nghttp2-in.cc @@ -1235,14 +1235,14 @@ int IncomingHTTP2Connection::on_data_chunk_recv_callback(nghttp2_session* sessio int IncomingHTTP2Connection::on_error_callback(nghttp2_session* session, int lib_error_code, const char* msg, size_t len, void* user_data) { (void)session; - auto* conn = static_cast(user_data); + const auto* conn = static_cast(user_data); VERBOSESLOG(infolog("Error in HTTP/2 connection from %s: %s (%d)", conn->d_ci.remote.toStringWithPort(), std::string(msg, len), lib_error_code), conn->getLogger()->error(Logr::Info, std::string(msg, len), "Error on DoH connection", "nghttp2.error_code", Logging::Loggable(lib_error_code))); - conn->d_connectionClosing = true; - conn->d_needFlush = true; - nghttp2_session_terminate_session(conn->d_session.get(), NGHTTP2_NO_ERROR); + /* nothing to do except logging here, the library will take + care of closing the offending stream if possible, or the whole + connection if needed. */ return 0; } diff --git a/pdns/dnsdistdist/dnsdist-nghttp2.cc b/pdns/dnsdistdist/dnsdist-nghttp2.cc index 28e7d5380e..9af1c2f675 100644 --- a/pdns/dnsdistdist/dnsdist-nghttp2.cc +++ b/pdns/dnsdistdist/dnsdist-nghttp2.cc @@ -802,12 +802,13 @@ int DoHConnectionToBackend::on_header_callback(nghttp2_session* session, const n int DoHConnectionToBackend::on_error_callback(nghttp2_session* session, int lib_error_code, const char* msg, size_t len, void* user_data) { (void)session; - DoHConnectionToBackend* conn = reinterpret_cast(user_data); + const auto* conn = static_cast(user_data); VERBOSESLOG(infolog("Error in HTTP/2 connection: %s (%d)", std::string(msg, len), lib_error_code), conn->getLogger()->error(Logr::Info, std::string(msg, len), "Error in HTTP/2 connection", "nghttp2.error_code", Logging::Loggable(lib_error_code))); - conn->d_connectionDied = true; - ++conn->d_ds->tcpDiedReadingResponse; + /* nothing to do except logging here, the library will take + care of closing the offending stream if possible, or the whole + connection if needed. */ return 0; }