|
|
@ -351,8 +351,8 @@ CAddrInfo CAddrMan::Select_(bool newOnly) |
|
|
|
int nKBucket = RandomInt(ADDRMAN_TRIED_BUCKET_COUNT); |
|
|
|
int nKBucket = RandomInt(ADDRMAN_TRIED_BUCKET_COUNT); |
|
|
|
int nKBucketPos = RandomInt(ADDRMAN_BUCKET_SIZE); |
|
|
|
int nKBucketPos = RandomInt(ADDRMAN_BUCKET_SIZE); |
|
|
|
while (vvTried[nKBucket][nKBucketPos] == -1) { |
|
|
|
while (vvTried[nKBucket][nKBucketPos] == -1) { |
|
|
|
nKBucket = (nKBucket + insecure_rand.rand32()) % ADDRMAN_TRIED_BUCKET_COUNT; |
|
|
|
nKBucket = (nKBucket + insecure_rand.randbits(ADDRMAN_TRIED_BUCKET_COUNT_LOG2)) % ADDRMAN_TRIED_BUCKET_COUNT; |
|
|
|
nKBucketPos = (nKBucketPos + insecure_rand.rand32()) % ADDRMAN_BUCKET_SIZE; |
|
|
|
nKBucketPos = (nKBucketPos + insecure_rand.randbits(ADDRMAN_BUCKET_SIZE_LOG2)) % ADDRMAN_BUCKET_SIZE; |
|
|
|
} |
|
|
|
} |
|
|
|
int nId = vvTried[nKBucket][nKBucketPos]; |
|
|
|
int nId = vvTried[nKBucket][nKBucketPos]; |
|
|
|
assert(mapInfo.count(nId) == 1); |
|
|
|
assert(mapInfo.count(nId) == 1); |
|
|
@ -368,8 +368,8 @@ CAddrInfo CAddrMan::Select_(bool newOnly) |
|
|
|
int nUBucket = RandomInt(ADDRMAN_NEW_BUCKET_COUNT); |
|
|
|
int nUBucket = RandomInt(ADDRMAN_NEW_BUCKET_COUNT); |
|
|
|
int nUBucketPos = RandomInt(ADDRMAN_BUCKET_SIZE); |
|
|
|
int nUBucketPos = RandomInt(ADDRMAN_BUCKET_SIZE); |
|
|
|
while (vvNew[nUBucket][nUBucketPos] == -1) { |
|
|
|
while (vvNew[nUBucket][nUBucketPos] == -1) { |
|
|
|
nUBucket = (nUBucket + insecure_rand.rand32()) % ADDRMAN_NEW_BUCKET_COUNT; |
|
|
|
nUBucket = (nUBucket + insecure_rand.randbits(ADDRMAN_NEW_BUCKET_COUNT_LOG2)) % ADDRMAN_NEW_BUCKET_COUNT; |
|
|
|
nUBucketPos = (nUBucketPos + insecure_rand.rand32()) % ADDRMAN_BUCKET_SIZE; |
|
|
|
nUBucketPos = (nUBucketPos + insecure_rand.randbits(ADDRMAN_BUCKET_SIZE_LOG2)) % ADDRMAN_BUCKET_SIZE; |
|
|
|
} |
|
|
|
} |
|
|
|
int nId = vvNew[nUBucket][nUBucketPos]; |
|
|
|
int nId = vvNew[nUBucket][nUBucketPos]; |
|
|
|
assert(mapInfo.count(nId) == 1); |
|
|
|
assert(mapInfo.count(nId) == 1); |
|
|
|