3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-02-14 19:25:51 +00:00

Fix a bug that could cause failure to reach the requested number of peers if peer connections failed immediately due to unroutable addresses.

This commit is contained in:
Mike Hearn 2012-12-24 22:33:04 +00:00
parent 07011be796
commit 8e91459dcc

View File

@ -804,7 +804,10 @@ public class PeerGroup extends AbstractIdleService {
// This can run on any Netty worker thread. Because connectToAnyPeer() must run unlocked to avoid circular
// deadlock, this method must run largely unlocked too. Some members are thread-safe and others aren't, so
// we synchronize only the parts that need it.
if (!isRunning()) return;
// Peer deaths can occur during startup if a connect attempt after peer discovery aborts immediately.
if (state() != State.RUNNING && state() != State.STARTING) return;
checkArgument(!peers.contains(peer));
final Peer downloadPeer;
final PeerEventListener downloadListener;