Balance peer selection in getFetchPack

This commit is contained in:
JoelKatz
2015-02-09 23:28:40 -08:00
committed by Tom Ritchford
parent 70d8b2c4b7
commit 7bd339b645

View File

@@ -576,9 +576,7 @@ public:
{
if (peer->hasRange (nextLedger->getLedgerSeq() - 1, nextLedger->getLedgerSeq()))
{
if (count++ == 0)
target = peer;
else if ((rand () % ++count) == 0)
if ((count++ == 0) || ((rand() % count) == 0))
target = peer;
}
}