]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Introduce an invalidate() method instead of assigning directly
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Wed, 16 Sep 2020 09:44:59 +0000 (11:44 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Wed, 16 Sep 2020 09:44:59 +0000 (11:44 +0200)
pdns/cachecleaner.hh
pdns/recursor_cache.hh
pdns/recursordist/negcache.hh

index 2bca3b3f784464e71858263043ba08cf585b2cb4..a06a35e0865d5e59161262d8eecf93e1915929ca 100644 (file)
@@ -144,7 +144,7 @@ template <typename S, typename C, typename T> uint64_t pruneMutexCollectionsVect
 
   for (auto& mc : maps) {
     const typename C::lock l(mc);
-    mc.d_cachecachevalid = false;
+    mc.invalidate();
     auto& sidx = boost::multi_index::get<S>(mc.d_map);
     uint64_t erased = 0, lookedAt = 0;
     for (auto i = sidx.begin(); i != sidx.end(); lookedAt++) {
@@ -178,7 +178,7 @@ template <typename S, typename C, typename T> uint64_t pruneMutexCollectionsVect
     size_t pershard = toTrim / maps_size + 1;
     for (auto& mc : maps) {
       const typename C::lock l(mc);
-      mc.d_cachecachevalid = false;
+      mc.invalidate();
       auto& sidx = boost::multi_index::get<S>(mc.d_map);
       size_t removed = 0;
       for (auto i = sidx.begin(); i != sidx.end() && removed < pershard; removed++) {
index d2f66cef5897ab3da0c8f294c0bcb3f0de302a28..8166ddab8afc76e94c134e56b850a22040181947 100644 (file)
@@ -214,6 +214,11 @@ private:
     std::atomic<uint64_t> d_entriesCount{0};
     uint64_t d_contended_count{0};
     uint64_t d_acquired_count{0};
+
+    void invalidate()
+    {
+      d_cachecachevalid = false;
+    }
   };
 
   vector<MapCombo> d_maps;
index d27432426e073a1919fa4f79ae75f2085f13701c..1618d5af7293ebfc3d1418a579f2899c296b7458 100644 (file)
@@ -115,7 +115,7 @@ private:
     std::atomic<uint64_t> d_entriesCount{0};
     mutable uint64_t d_contended_count{0};
     mutable uint64_t d_acquired_count{0};
-    bool d_cachecachevalid{false}; // XXX
+    void invalidate() {}
   };
 
   vector<MapCombo> d_maps;