From: Remi Gacogne Date: Mon, 17 Jun 2019 13:46:57 +0000 (+0200) Subject: dnsdist: Make the frontend code dedup clearer X-Git-Tag: dnsdist-1.4.0-rc1~119^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F7934%2Fhead;p=thirdparty%2Fpdns.git dnsdist: Make the frontend code dedup clearer --- diff --git a/pdns/dnsdist-carbon.cc b/pdns/dnsdist-carbon.cc index b0b2997c2a..e3fc46fa17 100644 --- a/pdns/dnsdist-carbon.cc +++ b/pdns/dnsdist-carbon.cc @@ -113,9 +113,9 @@ try string frontName = front->local.toString() + ":" + std::to_string(front->local.getPort()) + (front->udpFD >= 0 ? "_udp" : "_tcp"); boost::replace_all(frontName, ".", "_"); auto dupPair = frontendDuplicates.insert({frontName, 1}); - if (dupPair.second == false) { + if (!dupPair.second) { frontName = frontName + "_" + std::to_string(dupPair.first->second); - ++dupPair.first->second; + ++(dupPair.first->second); } const string base = namespace_name + "." + hostname + "." + instance_name + ".frontends." + frontName + "."; @@ -167,9 +167,9 @@ try boost::replace_all(name, "]", "_"); auto dupPair = dohFrontendDuplicates.insert({name, 1}); - if (dupPair.second == false) { + if (!dupPair.second) { name = name + "_" + std::to_string(dupPair.first->second); - ++dupPair.first->second; + ++(dupPair.first->second); } vector&>> v{ diff --git a/pdns/dnsdist-web.cc b/pdns/dnsdist-web.cc index f0ff9602cf..a31c1a924a 100644 --- a/pdns/dnsdist-web.cc +++ b/pdns/dnsdist-web.cc @@ -532,9 +532,9 @@ static void connectionThread(int sock, ComboAddress remote) string proto = (front->udpFD >= 0 ? "udp" : "tcp"); string fullName = frontName + "_" + proto; auto dupPair = frontendDuplicates.insert({fullName, 1}); - if (dupPair.second == false) { + if (!dupPair.second) { frontName = frontName + "_" + std::to_string(dupPair.first->second); - ++dupPair.first->second; + ++(dupPair.first->second); } output << "dnsdist_frontend_queries{frontend=\"" << frontName << "\",proto=\"" << proto