3
0
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:
Mike Hearn 2015-10-08 16:10:48 +02:00
parent fabbb0a9ac
commit 0079c272ff

View File

@ -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
* 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) {
lock.lock();
try {
this.requiredServices = requiredServices;
peerDiscoverers.clear();
peerDiscoverers.add(MultiplexingDiscovery.forServices(params, requiredServices));
addPeerDiscovery(MultiplexingDiscovery.forServices(params, requiredServices));
} finally {
lock.unlock();
}