mirror of
https://github.com/oxen-io/oxen-core.git
synced 2023-12-14 02:22:56 +01: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