Skip to content

Commit

Permalink
Merge pull request #14176 from fredmorcos/ueberbackend-cleanup
Browse files Browse the repository at this point in the history
`UeberBackend` cleanups
  • Loading branch information
fredmorcos authored May 16, 2024
2 parents 6e22f64 + ea279be commit 6fe0cdf
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions pdns/ueberbackend.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,14 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <memory>
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <boost/archive/binary_iarchive.hpp>
#include <boost/archive/binary_oarchive.hpp>

#include "auth-querycache.hh"
#include "auth-zonecache.hh"
#include "utility.hh"

#include <cerrno>
#include <dlfcn.h>
#include <functional>
#include <iostream>
#include <map>
#include <sstream>
#include <string>
#include <sys/types.h>

Expand Down Expand Up @@ -114,7 +106,7 @@ void UeberBackend::go()
s_backendQueries = S.getPointer("backend-queries");

{
std::unique_lock<std::mutex> l(d_mut);
std::unique_lock<std::mutex> lock(d_mut);
d_go = true;
}
d_cond.notify_all();
Expand Down Expand Up @@ -606,10 +598,10 @@ bool UeberBackend::autoPrimariesList(std::vector<AutoPrimary>& primaries)
return false;
}

bool UeberBackend::autoPrimaryBackend(const string& ip, const DNSName& domain, const vector<DNSResourceRecord>& nsset, string* nameserver, string* account, DNSBackend** dnsBackend)
bool UeberBackend::autoPrimaryBackend(const string& ipAddr, const DNSName& domain, const vector<DNSResourceRecord>& nsset, string* nameserver, string* account, DNSBackend** dnsBackend)
{
for (auto& backend : backends) {
if (backend->autoPrimaryBackend(ip, domain, nsset, nameserver, account, dnsBackend)) {
if (backend->autoPrimaryBackend(ipAddr, domain, nsset, nameserver, account, dnsBackend)) {
return true;
}
}
Expand Down Expand Up @@ -654,6 +646,7 @@ enum UeberBackend::CacheResult UeberBackend::cacheHas(const Question& question,
void UeberBackend::addNegCache(const Question& question) const
{
extern AuthQueryCache QC;

if (d_negcache_ttl == 0) {
return;
}
Expand Down Expand Up @@ -709,8 +702,8 @@ void UeberBackend::lookup(const QType& qtype, const DNSName& qname, int zoneId,
DLOG(g_log << "UeberBackend received question for " << qtype << " of " << qname << endl);
if (!d_go) {
g_log << Logger::Error << "UeberBackend is blocked, waiting for 'go'" << endl;
std::unique_lock<std::mutex> l(d_mut);
d_cond.wait(l, [] { return d_go; });
std::unique_lock<std::mutex> lock(d_mut);
d_cond.wait(lock, [] { return d_go; });
g_log << Logger::Error << "Broadcast received, unblocked" << endl;
}

Expand Down

0 comments on commit 6fe0cdf

Please sign in to comment.