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_()
341341 while (1 ) {
342342 int nKBucket = GetRandInt (ADDRMAN_TRIED_BUCKET_COUNT);
343343 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+ }
346348 int nId = vvTried[nKBucket][nKBucketPos];
347349 assert (mapInfo.count (nId) == 1 );
348350 CAddrInfo& info = mapInfo[nId];
@@ -356,8 +358,10 @@ CAddrInfo CAddrMan::Select_()
356358 while (1 ) {
357359 int nUBucket = GetRandInt (ADDRMAN_NEW_BUCKET_COUNT);
358360 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+ }
361365 int nId = vvNew[nUBucket][nUBucketPos];
362366 assert (mapInfo.count (nId) == 1 );
363367 CAddrInfo& info = mapInfo[nId];
You can’t perform that action at this time.
0 commit comments