mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-15 11:45:51 +00:00
PeerGroup: fix a bug that'd leave maxConnections == 0 if setRequiredServices was used without configuring any other discovery (a typical use case).
This commit is contained in:
parent
fabbb0a9ac
commit
0079c272ff
@ -831,14 +831,14 @@ public class PeerGroup implements TransactionBroadcaster {
|
|||||||
/**
|
/**
|
||||||
* Convenience for connecting only to peers that can serve specific services. It will configure suitable peer
|
* Convenience for connecting only to peers that can serve specific services. It will configure suitable peer
|
||||||
* discoveries.
|
* discoveries.
|
||||||
* @param services Required services as a bitmask, e.g. {@link VersionMessage#NODE_NETWORK}.
|
* @param requiredServices Required services as a bitmask, e.g. {@link VersionMessage#NODE_NETWORK}.
|
||||||
*/
|
*/
|
||||||
public void setRequiredServices(long requiredServices) {
|
public void setRequiredServices(long requiredServices) {
|
||||||
lock.lock();
|
lock.lock();
|
||||||
try {
|
try {
|
||||||
this.requiredServices = requiredServices;
|
this.requiredServices = requiredServices;
|
||||||
peerDiscoverers.clear();
|
peerDiscoverers.clear();
|
||||||
peerDiscoverers.add(MultiplexingDiscovery.forServices(params, requiredServices));
|
addPeerDiscovery(MultiplexingDiscovery.forServices(params, requiredServices));
|
||||||
} finally {
|
} finally {
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user