diff --git a/repertory/librepertory/include/comm/curl/dns_cache.hpp b/repertory/librepertory/include/comm/curl/dns_cache.hpp index 7e7b01bd..5eb156cd 100644 --- a/repertory/librepertory/include/comm/curl/dns_cache.hpp +++ b/repertory/librepertory/include/comm/curl/dns_cache.hpp @@ -46,7 +46,6 @@ public: private: static curl_sh_t cache_; - static std::unique_ptr lock_; static std::recursive_mutex mtx_; private: diff --git a/repertory/librepertory/src/comm/curl/dns_cache.cpp b/repertory/librepertory/src/comm/curl/dns_cache.cpp index bd9bb0f5..c9edfc7d 100644 --- a/repertory/librepertory/src/comm/curl/dns_cache.cpp +++ b/repertory/librepertory/src/comm/curl/dns_cache.cpp @@ -24,23 +24,20 @@ namespace repertory { dns_cache::curl_sh_t dns_cache::cache_; -std::unique_ptr dns_cache::lock_; - std::recursive_mutex dns_cache::mtx_; void dns_cache::cleanup() { cache_.reset(nullptr); } void dns_cache::init() { - lock_ = std::make_unique(mtx_); auto *cache = curl_share_init(); if (cache == nullptr) { return; } + cache_.reset(cache); curl_share_setopt(cache, CURLSHOPT_SHARE, CURL_LOCK_DATA_DNS); curl_share_setopt(cache, CURLSHOPT_LOCKFUNC, lock_callback); curl_share_setopt(cache, CURLSHOPT_UNLOCKFUNC, unlock_callback); - cache_.reset(cache); } void dns_cache::lock_callback(CURL * /* curl */, curl_lock_data data, @@ -49,7 +46,7 @@ void dns_cache::lock_callback(CURL * /* curl */, curl_lock_data data, return; } - lock_->lock(); + mtx_.lock(); } void dns_cache::set_cache(CURL *curl) { @@ -63,6 +60,6 @@ void dns_cache::unlock_callback(CURL * /* curl */, curl_lock_data data, return; } - lock_->unlock(); + mtx_.unlock(); } } // namespace repertory