From: Remi Gacogne Date: Fri, 4 Feb 2022 15:14:34 +0000 (+0100) Subject: dnsdist: Uglify the code to make the formatter happy X-Git-Tag: rec-4.7.0-alpha1~9^2~20 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f468a7fe4b8cb384ab81c814faccf8c83823a64f;p=thirdparty%2Fpdns.git dnsdist: Uglify the code to make the formatter happy --- diff --git a/pdns/dnsdist-lua.cc b/pdns/dnsdist-lua.cc index 6ecdea0ec5..e609699261 100644 --- a/pdns/dnsdist-lua.cc +++ b/pdns/dnsdist-lua.cc @@ -576,15 +576,15 @@ static void setupLuaConfig(LuaContext& luaCtx, bool client, bool configCheck) tlsCtx = getTLSContext(tlsParams); if (vars.count("dohPath")) { -#ifdef HAVE_NGHTTP2 +#ifndef HAVE_NGHTTP2 + throw std::runtime_error("Outgoing DNS over HTTPS support requested (via 'dohPath' on newServer()) but nghttp2 support is not available"); +#endif + config.d_dohPath = boost::get(vars.at("dohPath")); if (vars.count("addXForwardedHeaders")) { config.d_addXForwardedHeaders = boost::get(vars.at("addXForwardedHeaders")); } -#else /* HAVE_NGHTTP2 */ - throw std::runtime_error("Outgoing DNS over HTTPS support requested (via 'dohPath' on newServer()) but nghttp2 support is not available"); -#endif /* HAVE_NGHTTP2 */ } } diff --git a/pdns/dnsdistdist/dnsdist-discovery.cc b/pdns/dnsdistdist/dnsdist-discovery.cc index d1e06184ab..bcc9720088 100644 --- a/pdns/dnsdistdist/dnsdist-discovery.cc +++ b/pdns/dnsdistdist/dnsdist-discovery.cc @@ -28,7 +28,8 @@ #include "dolog.hh" #include "sstuff.hh" -namespace dnsdist { +namespace dnsdist +{ const DNSName ServiceDiscovery::s_discoveryDomain{"_dns.resolver.arpa."}; const QType ServiceDiscovery::s_discoveryType{QType::SVCB}; @@ -67,12 +68,12 @@ static bool parseSVCParams(const PacketBuffer& answer, std::map(packet.size()); - const uint8_t sizeBytes[] = { static_cast(querySize / 256), static_cast(querySize % 256) }; + const uint8_t sizeBytes[] = {static_cast(querySize / 256), static_cast(querySize % 256)}; packet.insert(packet.begin(), sizeBytes, sizeBytes + 2); Socket sock(addr.sin4.sin_family, SOCK_STREAM); @@ -281,7 +282,7 @@ bool ServiceDiscovery::getDiscoveredConfig(const UpgradeableBackend& upgradeable packet.resize(ntohs(responseSize)); - got = sock.readWithTimeout(reinterpret_cast(packet.data()), packet.size(), backend->d_config.tcpRecvTimeout); + got = sock.readWithTimeout(reinterpret_cast(packet.data()), packet.size(), backend->d_config.tcpRecvTimeout); if (got < 0 || static_cast(got) != packet.size()) { if (g_verbose) { warnlog("Error while waiting for the ADD upgrade response from backend %s: %d", addr.toString(), got); @@ -445,7 +446,7 @@ void ServiceDiscovery::worker() auto upgradeables = *(s_upgradeableBackends.lock()); std::set> upgradedBackends; - for (auto backendIt = upgradeables.begin(); backendIt != upgradeables.end(); ) { + for (auto backendIt = upgradeables.begin(); backendIt != upgradeables.end();) { try { auto& backend = *backendIt; if (backend.d_nextCheck > now) { @@ -471,10 +472,9 @@ void ServiceDiscovery::worker() } } - { auto backends = s_upgradeableBackends.lock(); - for (auto it = backends->begin(); it != backends->end(); ) { + for (auto it = backends->begin(); it != backends->end();) { if (upgradedBackends.count(it->d_ds) != 0) { it = backends->erase(it); } diff --git a/pdns/dnsdistdist/dnsdist-discovery.hh b/pdns/dnsdistdist/dnsdist-discovery.hh index a2591c37f8..d96777b89e 100644 --- a/pdns/dnsdistdist/dnsdist-discovery.hh +++ b/pdns/dnsdistdist/dnsdist-discovery.hh @@ -30,12 +30,12 @@ struct DownstreamState; -namespace dnsdist { +namespace dnsdist +{ class ServiceDiscovery { public: - static bool addUpgradeableServer(std::shared_ptr& server, uint32_t interval, std::string poolAfterUpgrade, uint16_t dohSVCKey, bool keepAfterUpgrade); /* starts a background thread if needed */ diff --git a/pdns/dnsdistdist/dnsdist-nghttp2.cc b/pdns/dnsdistdist/dnsdist-nghttp2.cc index 8e2b9d95af..42ad2bc656 100644 --- a/pdns/dnsdistdist/dnsdist-nghttp2.cc +++ b/pdns/dnsdistdist/dnsdist-nghttp2.cc @@ -191,7 +191,7 @@ bool DoHConnectionToBackend::reachedMaxStreamID() const bool DoHConnectionToBackend::reachedMaxConcurrentQueries() const { - //cerr<<"Got "<handleResponseError(std::move(request), now); } - //cerr<<"we now have "<getConcurrentStreamsCount()<<" concurrent connections"<getConcurrentStreamsCount()<<" concurrent connections"<isIdle()) { - //cerr<<"stopping IO"<stopIO(); conn->watchForRemoteHostClosingConnection(); } @@ -742,9 +742,9 @@ int DoHConnectionToBackend::on_header_callback(nghttp2_session* session, const n const std::string status(":status"); if (frame->hd.type == NGHTTP2_HEADERS && frame->headers.cat == NGHTTP2_HCAT_RESPONSE) { - //cerr<<"got header for "<hd.stream_id<<":"<(name), namelen)<(value), valuelen)<hd.stream_id<<":"<(name), namelen)<(value), valuelen)<d_currentStreams.find(frame->hd.stream_id); if (stream == conn->d_currentStreams.end()) {