]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Reformat
authorChris Hofstaedtler <chris.hofstaedtler@deduktiva.com>
Mon, 15 Mar 2021 09:05:27 +0000 (10:05 +0100)
committerChris Hofstaedtler <chris.hofstaedtler@deduktiva.com>
Sat, 15 May 2021 22:45:45 +0000 (00:45 +0200)
modules/bindbackend/bindbackend2.cc
pdns/auth-domaincache.cc
pdns/auth-domaincache.hh

index 0010a2a9b2239c25bac90cf81ae3a782bac3fb84..750125276f8cd22f2fd8029bc4f40c4bba03c886 100644 (file)
@@ -704,7 +704,7 @@ string Bind2Backend::DLAddDomainHandler(const vector<string>& parts, Utility::pi
 
   safePutBBDomainInfo(bbd);
 
-  g_domainCache.add(domainname, bbd.d_id);  // make new domain visible
+  g_domainCache.add(domainname, bbd.d_id); // make new domain visible
 
   g_log << Logger::Warning << "Zone " << domainname << " loaded" << endl;
   return "Loaded zone " + domainname.toLogString() + " from " + filename;
index 65b9839a9d0c6dcdf6043687144823184ef28da5..c23ce7a1eed17cd64aa102216ef937787c6ccadb 100644 (file)
 #include "cachecleaner.hh"
 extern StatBag S;
 
-AuthDomainCache::AuthDomainCache(size_t mapsCount): d_maps(mapsCount)
+AuthDomainCache::AuthDomainCache(size_t mapsCount) :
+  d_maps(mapsCount)
 {
   S.declare("domain-cache-hit", "Number of hits on the domain cache");
   S.declare("domain-cache-miss", "Number of misses on the domain cache");
   S.declare("domain-cache-size", "Number of entries in the domain cache", StatType::gauge);
 
-  d_statnumhit=S.getPointer("domain-cache-hit");
-  d_statnummiss=S.getPointer("domain-cache-miss");
-  d_statnumentries=S.getPointer("domain-cache-size");
+  d_statnumhit = S.getPointer("domain-cache-hit");
+  d_statnummiss = S.getPointer("domain-cache-miss");
+  d_statnumentries = S.getPointer("domain-cache-size");
 
   d_ttl = 0;
 }
@@ -47,16 +48,16 @@ AuthDomainCache::~AuthDomainCache()
 {
   try {
     vector<WriteLock> locks;
-    for(auto& mc : d_maps) {
+    for (auto& mc : d_maps) {
       locks.push_back(WriteLock(mc.d_mut));
     }
     locks.clear();
   }
-  catch(...) {
+  catch (...) {
   }
 }
 
-bool AuthDomainCache::getEntry(const DNSName &domain, int& zoneId)
+bool AuthDomainCache::getEntry(const DNSNamedomain, int& zoneId)
 {
   auto& mc = getMap(domain);
   bool found = false;
@@ -71,7 +72,8 @@ bool AuthDomainCache::getEntry(const DNSName &domain, int& zoneId)
 
   if (found) {
     (*d_statnumhit)++;
-  } else {
+  }
+  else {
     (*d_statnummiss)++;
   }
   return found;
@@ -87,16 +89,16 @@ void AuthDomainCache::clear()
   purgeLockedCollectionsVector(d_maps);
 }
 
-void AuthDomainCache::replace(const vector<tuple<DNSName, int>> &domain_indices)
+void AuthDomainCache::replace(const vector<tuple<DNSName, int>>domain_indices)
 {
-  if(!d_ttl)
+  if (!d_ttl)
     return;
 
   size_t count = domain_indices.size();
   vector<MapCombo> newMaps(d_maps.size());
 
   // build new maps
-  for(const tuple<DNSName, int>& tup: domain_indices) {
+  for (const tuple<DNSName, int>& tup : domain_indices) {
     const DNSName& domain = tup.get<0>();
     CacheValue val;
     val.zoneId = tup.get<1>();
@@ -104,8 +106,7 @@ void AuthDomainCache::replace(const vector<tuple<DNSName, int>> &domain_indices)
     mc.d_map.emplace(domain, val);
   }
 
-  for(size_t mapIndex = 0; mapIndex < d_maps.size(); mapIndex++)
-  {
+  for (size_t mapIndex = 0; mapIndex < d_maps.size(); mapIndex++) {
     auto& mc = d_maps[mapIndex];
     WriteLock l(mc.d_mut);
     mc.d_map = std::move(newMaps[mapIndex].d_map);
@@ -116,7 +117,7 @@ void AuthDomainCache::replace(const vector<tuple<DNSName, int>> &domain_indices)
 
 void AuthDomainCache::add(const DNSName& domain, const int zoneId)
 {
-  if(!d_ttl)
+  if (!d_ttl)
     return;
 
   CacheValue val;
index 7bdfd188bdbed73f13cbc74193b4c8a239b3f1e0..162d98f51107d6daa3a41abbc1d333d52e5f946a 100644 (file)
 class AuthDomainCache : public boost::noncopyable
 {
 public:
-  AuthDomainCache(size_t mapsCount=1024);
+  AuthDomainCache(size_t mapsCount = 1024);
   ~AuthDomainCache();
 
-  void replace(const vector<tuple<DNSName, int>> &domains);
+  void replace(const vector<tuple<DNSName, int>>domains);
   void add(const DNSName& domain, const int zoneId);
 
-  bool getEntry(const DNSName &domain, int &zoneId);
+  bool getEntry(const DNSName& domain, int& zoneId);
 
   size_t size() { return *d_statnumentries; } //!< number of entries in the cache
 
-  uint32_t getTTL() const {
+  uint32_t getTTL() const
+  {
     return d_ttl;
   }
 
-  void setTTL(uint32_t ttl) {
+  void setTTL(uint32_t ttl)
+  {
     d_ttl = ttl;
   }
 
@@ -60,10 +62,10 @@ private:
 
   struct MapCombo
   {
-    MapCombo() { }
-    ~MapCombo() { }
-    MapCombo(const MapCombo &) = delete;
-    MapCombo & operator=(const MapCombo &) = delete;
+    MapCombo() {}
+    ~MapCombo() {}
+    MapCombo(const MapCombo&) = delete;
+    MapCombo& operator=(const MapCombo&) = delete;
 
     ReadWriteLock d_mut;
     cmap_t d_map;
@@ -79,9 +81,9 @@ private:
     return d_maps[getMapIndex(qname)];
   }
 
-  AtomicCounter *d_statnumhit;
-  AtomicCounter *d_statnummiss;
-  AtomicCounter *d_statnumentries;
+  AtomicCounterd_statnumhit;
+  AtomicCounterd_statnummiss;
+  AtomicCounterd_statnumentries;
 
   time_t d_ttl{0};
 };