mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-12 02:05:53 +00:00
Fix lock inversion.
This commit is contained in:
parent
b71015a297
commit
eb7c4be136
@ -1098,8 +1098,11 @@ public class PeerGroup extends AbstractIdleService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Given a list of Peers, return a Peer to be used as the download peer. */
|
/** Given a list of Peers, return a Peer to be used as the download peer. */
|
||||||
protected Peer selectDownloadPeer(List<Peer> peers) {
|
protected Peer selectDownloadPeer(List<Peer> origPeers) {
|
||||||
synchronized (peers) {
|
List<Peer> peers;
|
||||||
|
synchronized (origPeers) {
|
||||||
|
peers = new ArrayList<Peer>(origPeers);
|
||||||
|
}
|
||||||
if (peers.isEmpty())
|
if (peers.isEmpty())
|
||||||
return null;
|
return null;
|
||||||
// Make sure we don't select a peer that is behind/synchronizing itself.
|
// Make sure we don't select a peer that is behind/synchronizing itself.
|
||||||
@ -1109,7 +1112,6 @@ public class PeerGroup extends AbstractIdleService {
|
|||||||
}
|
}
|
||||||
throw new IllegalStateException("Unreachable");
|
throw new IllegalStateException("Unreachable");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private static class PeerGroupThreadFactory implements ThreadFactory {
|
private static class PeerGroupThreadFactory implements ThreadFactory {
|
||||||
static final AtomicInteger poolNumber = new AtomicInteger(1);
|
static final AtomicInteger poolNumber = new AtomicInteger(1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user