mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +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