Use C++11 thread-safe static initializers
This commit is contained in:
@@ -5160,11 +5160,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
||||
LOCK(cs_vNodes);
|
||||
// Use deterministic randomness to send to the same nodes for 24 hours
|
||||
// at a time so the addrKnowns of the chosen nodes prevent repeats
|
||||
static uint64_t salt0 = 0, salt1 = 0;
|
||||
while (salt0 == 0 && salt1 == 0) {
|
||||
GetRandBytes((unsigned char*)&salt0, sizeof(salt0));
|
||||
GetRandBytes((unsigned char*)&salt1, sizeof(salt1));
|
||||
}
|
||||
static const uint64_t salt0 = GetRand(std::numeric_limits<uint64_t>::max());
|
||||
static const uint64_t salt1 = GetRand(std::numeric_limits<uint64_t>::max());
|
||||
uint64_t hashAddr = addr.GetHash();
|
||||
multimap<uint64_t, CNode*> mapMix;
|
||||
const CSipHasher hasher = CSipHasher(salt0, salt1).Write(hashAddr << 32).Write((GetTime() + hashAddr) / (24*60*60));
|
||||
|
||||
Reference in New Issue
Block a user