From: Otto Moerbeek Date: Mon, 20 Nov 2023 15:08:02 +0000 (+0100) Subject: The nod code sets up the SBF DBs before starting the thraed, no need for protection X-Git-Tag: dnsdist-1.9.0-alpha4~20^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=888efc7b11193a0b44698fe832890b0d8fbd68b6;p=thirdparty%2Fpdns.git The nod code sets up the SBF DBs before starting the thraed, no need for protection --- diff --git a/pdns/recursordist/nod.cc b/pdns/recursordist/nod.cc index e35fc699b0..811811ca6a 100644 --- a/pdns/recursordist/nod.cc +++ b/pdns/recursordist/nod.cc @@ -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 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 diff --git a/pdns/recursordist/nod.hh b/pdns/recursordist/nod.hh index ede60d31dd..a27b1d77fd 100644 --- a/pdns/recursordist/nod.hh +++ b/pdns/recursordist/nod.hh @@ -68,7 +68,6 @@ public: private: void remove_tmp_files(const boost::filesystem::path&, std::lock_guard&); - bool d_init{false}; LockGuarded d_sbf; // Stable Bloom Filter std::string d_cachedir; std::string d_prefix = sbf_prefix;