]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Let AuthZoneCache::removeFromView return whether the view is now empty.
authorMiod Vallat <miod.vallat@powerdns.com>
Wed, 28 May 2025 12:44:23 +0000 (14:44 +0200)
committerMiod Vallat <miod.vallat@powerdns.com>
Wed, 11 Jun 2025 05:27:20 +0000 (07:27 +0200)
pdns/auth-zonecache.cc
pdns/auth-zonecache.hh

index 342e269d5fa1c46595687d7460365f363c6464b9..3833055180d3adc2db96ade3c215e5c4a2d97bb6 100644 (file)
@@ -277,19 +277,20 @@ void AuthZoneCache::addToView(const std::string& view, const ZoneName& zone)
   map[view][strictZone] = zone.getVariant();
 }
 
-void AuthZoneCache::removeFromView(const std::string& view, const ZoneName& zone)
+bool AuthZoneCache::removeFromView(const std::string& view, const ZoneName& zone)
 {
   const DNSName& strictZone = zone.operator const DNSName&();
   auto views = d_views.write_lock();
   AuthZoneCache::ViewsMap& map = *views;
   if (map.count(view) == 0) {
-    return; // Nothing to do, we did not know about that view
+    return true; // Nothing to do, we did not know about that view
   }
   auto& innerMap = map.at(view);
   if (auto iter = innerMap.find(strictZone); iter != innerMap.end()) {
     innerMap.erase(iter);
   }
   // else nothing to do, we did not know about that zone in that view
+  return innerMap.empty();
 }
 
 void AuthZoneCache::updateNetwork(const Netmask& network, const std::string& view)
index c4459e86c3f88b48bc778d4f154ca5107d95a523..ec7babf895b8a7cb5c3f06b4716ea386005cb59f 100644 (file)
@@ -46,7 +46,7 @@ public:
 
   // Views maintainance
   void addToView(const std::string& view, const ZoneName& zone);
-  void removeFromView(const std::string& view, const ZoneName& zone);
+  bool removeFromView(const std::string& view, const ZoneName& zone);
 
   // Network maintainance
   void updateNetwork(const Netmask& network, const std::string& view);