mirror of
https://github.com/monero-project/monero.git
synced 2024-11-18 00:37:43 +00:00
dns_utils: lock access to the singleton
This avoids races which could result in two objects being created
This commit is contained in:
parent
5990344cb0
commit
f43d465da2
1 changed files with 4 additions and 0 deletions
|
@ -38,6 +38,8 @@
|
|||
using namespace epee;
|
||||
namespace bf = boost::filesystem;
|
||||
|
||||
static std::mutex instance_lock;
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
|
@ -326,6 +328,8 @@ std::string DNSResolver::get_dns_format_from_oa_address(const std::string& oa_ad
|
|||
|
||||
DNSResolver& DNSResolver::instance()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(instance_lock);
|
||||
|
||||
static DNSResolver* staticInstance = NULL;
|
||||
if (staticInstance == NULL)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue