mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-02-24 06:47:54 +01:00
PeerGroup.triggerConnectionsJob: Fix NullPointerException if inactives contains only IPv6 addresses.
This commit is contained in:
parent
9125c1f94a
commit
57de578707
1 changed files with 6 additions and 1 deletions
|
@ -490,11 +490,16 @@ public class PeerGroup implements TransactionBroadcaster {
|
||||||
do {
|
do {
|
||||||
addrToTry = inactives.poll();
|
addrToTry = inactives.poll();
|
||||||
} while (ipv6Unreachable && addrToTry.getAddr() instanceof Inet6Address);
|
} while (ipv6Unreachable && addrToTry.getAddr() instanceof Inet6Address);
|
||||||
|
if (addrToTry == null) {
|
||||||
|
// We have exhausted the queue of reachable peers, so just settle down.
|
||||||
|
// Most likely we were given a fixed set of addresses in some test scenario.
|
||||||
|
return;
|
||||||
|
}
|
||||||
long retryTime = backoffMap.get(addrToTry).getRetryTime();
|
long retryTime = backoffMap.get(addrToTry).getRetryTime();
|
||||||
retryTime = Math.max(retryTime, groupBackoff.getRetryTime());
|
retryTime = Math.max(retryTime, groupBackoff.getRetryTime());
|
||||||
if (retryTime > now) {
|
if (retryTime > now) {
|
||||||
long delay = retryTime - now;
|
long delay = retryTime - now;
|
||||||
log.info("Waiting {} ms before next connect attempt {}", delay, addrToTry == null ? "" : "to " + addrToTry);
|
log.info("Waiting {} ms before next connect attempt to {}", delay, addrToTry);
|
||||||
inactives.add(addrToTry);
|
inactives.add(addrToTry);
|
||||||
executor.schedule(this, delay, TimeUnit.MILLISECONDS);
|
executor.schedule(this, delay, TimeUnit.MILLISECONDS);
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Reference in a new issue