3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-02-11 17:55:53 +00:00

PeerGroup: don't keep trying every second when discovery returns zero peers but we have enough connections anyway.

This commit is contained in:
Mike Hearn 2014-12-04 15:20:28 +01:00
parent 7d7f826367
commit 625d19230d

View File

@ -463,8 +463,13 @@ public class PeerGroup implements TransactionBroadcaster {
}
// Inactives is sorted by backoffMap time.
if (inactives.isEmpty()) {
log.info("Peer discovery didn't provide us any more peers, will try again later.");
executor.schedule(this, groupBackoff.getRetryTime() - now, TimeUnit.MILLISECONDS);
if (countConnectedAndPendingPeers() < getMaxConnections()) {
log.info("Peer discovery didn't provide us any more peers, will try again later.");
executor.schedule(this, groupBackoff.getRetryTime() - now, TimeUnit.MILLISECONDS);
} else {
// We have enough peers and discovery provided no more, so just settle down. Most likely we
// were given a fixed set of addresses in some test scenario.
}
return;
} else {
do {