diff options
author | Luke Dashjr <luke-jr+git@utopios.org> | 2011-10-03 23:41:47 -0400 |
---|---|---|
committer | Luke Dashjr <luke-jr+git@utopios.org> | 2011-10-03 23:41:47 -0400 |
commit | a4e6ae101a02d6dfd981eab374336b78199895b2 (patch) | |
tree | c21d20c8cb5a575dc4d0671ed0ab3dc96452706f /src | |
parent | c7eb151ad0ed441d6fd598551059a9bbfb09e99e (diff) |
Only GetAdjustedTime once for the retry loop
Diffstat (limited to 'src')
-rw-r--r-- | src/net.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/net.cpp b/src/net.cpp index 2e257a6efc..0a48330b59 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -1387,6 +1387,8 @@ void ThreadOpenConnections2(void* parg) BOOST_FOREACH(CNode* pnode, vNodes) setConnected.insert(pnode->addr.ip & 0x0000ffff); + int64 nANow = GetAdjustedTime(); + CRITICAL_BLOCK(cs_mapAddresses) { BOOST_FOREACH(const PAIRTYPE(vector<unsigned char>, CAddress)& item, mapAddresses) @@ -1394,8 +1396,8 @@ void ThreadOpenConnections2(void* parg) const CAddress& addr = item.second; if (!addr.IsIPv4() || !addr.IsValid() || setConnected.count(addr.ip & 0x0000ffff)) continue; - int64 nSinceLastSeen = GetAdjustedTime() - addr.nTime; - int64 nSinceLastTry = GetAdjustedTime() - addr.nLastTry; + int64 nSinceLastSeen = nANow - addr.nTime; + int64 nSinceLastTry = nANow - addr.nLastTry; // Randomize the order in a deterministic way, putting the standard port first int64 nRandomizer = (uint64)(nStart * 4951 + addr.nLastTry * 9567851 + addr.ip * 7789) % (2 * 60 * 60); |