]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
The nod code sets up the SBF DBs before starting the thraed, no need for protection
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Mon, 20 Nov 2023 15:08:02 +0000 (16:08 +0100)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Mon, 20 Nov 2023 15:08:02 +0000 (16:08 +0100)
pdns/recursordist/nod.cc
pdns/recursordist/nod.hh

index e35fc699b002b67b9e4f4536c435c71388c93a9e..811811ca6ac8413d11e985d70df525e997b0f409 100644 (file)
@@ -57,9 +57,6 @@ void PersistentSBF::remove_tmp_files(const filesystem::path& p, std::lock_guard<
 // instances iterating and writing to the cache dir at the same time
 bool PersistentSBF::init(bool ignore_pid)
 {
-  if (d_init)
-    return false;
-
   auto log = g_slog->withName("nod");
   std::lock_guard<std::mutex> lock(d_cachedir_mutex);
   if (d_cachedir.length()) {
@@ -111,20 +108,19 @@ bool PersistentSBF::init(bool ignore_pid)
       return false;
     }
   }
-  d_init = true;
   return true;
 }
 
 void PersistentSBF::setCacheDir(const std::string& cachedir)
 {
-  if (!d_init) {
-    filesystem::path p(cachedir);
-    if (!exists(p))
-      throw PDNSException("NODDB setCacheDir specified nonexistent directory: " + cachedir);
-    else if (!is_directory(p))
-      throw PDNSException("NODDB setCacheDir specified a file not a directory: " + cachedir);
-    d_cachedir = cachedir;
+  filesystem::path path(cachedir);
+  if (!exists(path)) {
+    throw PDNSException("NODDB setCacheDir specified nonexistent directory: " + cachedir);
+  }
+  if (!is_directory(path)) {
+    throw PDNSException("NODDB setCacheDir specified a file not a directory: " + cachedir);
   }
+  d_cachedir = cachedir;
 }
 
 // Dump the SBF to a file
index ede60d31ddaa652cd83fd9b940cfb195635f1949..a27b1d77fd0cba671e0af36602d26d25a2fdfb0a 100644 (file)
@@ -68,7 +68,6 @@ public:
 private:
   void remove_tmp_files(const boost::filesystem::path&, std::lock_guard<std::mutex>&);
 
-  bool d_init{false};
   LockGuarded<bf::stableBF> d_sbf; // Stable Bloom Filter
   std::string d_cachedir;
   std::string d_prefix = sbf_prefix;