dns lookup: fix race condition accessing _errMsg
This commit is contained in:
@ -45,12 +45,21 @@ namespace ix
|
||||
|
||||
void run(uint64_t id, std::string hostname, int port); // thread runner
|
||||
|
||||
void setErrMsg(const std::string& errMsg);
|
||||
const std::string& getErrMsg();
|
||||
|
||||
void setRes(struct addrinfo* addr);
|
||||
struct addrinfo* getRes();
|
||||
|
||||
std::string _hostname;
|
||||
int _port;
|
||||
int64_t _wait;
|
||||
std::string _errMsg;
|
||||
|
||||
struct addrinfo* _res;
|
||||
static std::mutex _resMutex;
|
||||
std::mutex _resMutex;
|
||||
|
||||
std::string _errMsg;
|
||||
std::mutex _errMsgMutex;
|
||||
|
||||
std::atomic<bool> _done;
|
||||
std::thread _thread;
|
||||
|
Reference in New Issue
Block a user