dns_utils: lock access to the singleton

This avoids races which could result in two objects being created
pull/95/head
moneromooo-monero 9 years ago
parent 5990344cb0
commit f43d465da2
No known key found for this signature in database
GPG Key ID: 686F07454D6CEFC3

@ -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…
Cancel
Save