File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -341,8 +341,10 @@ CAddrInfo CAddrMan::Select_()
341
341
while (1 ) {
342
342
int nKBucket = GetRandInt (ADDRMAN_TRIED_BUCKET_COUNT);
343
343
int nKBucketPos = GetRandInt (ADDRMAN_BUCKET_SIZE);
344
- if (vvTried[nKBucket][nKBucketPos] == -1 )
345
- continue ;
344
+ while (vvTried[nKBucket][nKBucketPos] == -1 ) {
345
+ nKBucket = (nKBucket + insecure_rand ()) % ADDRMAN_TRIED_BUCKET_COUNT;
346
+ nKBucketPos = (nKBucketPos + insecure_rand ()) % ADDRMAN_BUCKET_SIZE;
347
+ }
346
348
int nId = vvTried[nKBucket][nKBucketPos];
347
349
assert (mapInfo.count (nId) == 1 );
348
350
CAddrInfo& info = mapInfo[nId];
@@ -356,8 +358,10 @@ CAddrInfo CAddrMan::Select_()
356
358
while (1 ) {
357
359
int nUBucket = GetRandInt (ADDRMAN_NEW_BUCKET_COUNT);
358
360
int nUBucketPos = GetRandInt (ADDRMAN_BUCKET_SIZE);
359
- if (vvNew[nUBucket][nUBucketPos] == -1 )
360
- continue ;
361
+ while (vvNew[nUBucket][nUBucketPos] == -1 ) {
362
+ nUBucket = (nUBucket + insecure_rand ()) % ADDRMAN_NEW_BUCKET_COUNT;
363
+ nUBucketPos = (nUBucketPos + insecure_rand ()) % ADDRMAN_BUCKET_SIZE;
364
+ }
361
365
int nId = vvNew[nUBucket][nUBucketPos];
362
366
assert (mapInfo.count (nId) == 1 );
363
367
CAddrInfo& info = mapInfo[nId];
You can’t perform that action at this time.
0 commit comments