removed possible data race on boolean value (Not critical)

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5161 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2012-05-12 13:10:57 +00:00
parent dc2d6c975e
commit 02a7548de4

View File

@ -202,6 +202,8 @@ bool ExtAddrFinder::hasValidIP(struct in_addr *addr)
std::cerr << "ExtAddrFinder: Getting ip." << std::endl ;
#endif
{
RsStackMutex mut(_addrMtx) ;
if(*_found)
{
#ifdef EXTADDRSEARCH_DEBUG
@ -209,9 +211,13 @@ bool ExtAddrFinder::hasValidIP(struct in_addr *addr)
#endif
*addr = *_addr;
}
}
time_t delta;
{
RsStackMutex mut(_addrMtx) ;
//timeout the current ip
time_t delta = time(NULL) - *mFoundTS;
delta = time(NULL) - *mFoundTS;
}
if((uint32_t)delta > MAX_IP_STORE) {//launch a research
if( _addrMtx.trylock())
{
@ -235,6 +241,7 @@ bool ExtAddrFinder::hasValidIP(struct in_addr *addr)
#endif
}
RsStackMutex mut(_addrMtx) ;
return *_found ;
}