mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-06-07 06:32:47 -04:00
Add internal `P2PService
` constructor with (unused) maximum connections argument
The value of ``P2PService.MAX_CONNECTIONS_DEFAULT`` is taken from the static block invocation of ``PeerManager.setMaxConnections()``.
This commit is contained in:
parent
a50bf41803
commit
f0aec0d55c
1 changed files with 26 additions and 0 deletions
|
@ -55,9 +55,11 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
public class P2PService implements SetupListener, MessageListener, ConnectionListener, RequestDataManager.Listener,
|
public class P2PService implements SetupListener, MessageListener, ConnectionListener, RequestDataManager.Listener,
|
||||||
HashMapChangedListener {
|
HashMapChangedListener {
|
||||||
private static final Logger log = LoggerFactory.getLogger(P2PService.class);
|
private static final Logger log = LoggerFactory.getLogger(P2PService.class);
|
||||||
|
public static final int MAX_CONNECTIONS_DEFAULT = 12;
|
||||||
|
|
||||||
private final SeedNodesRepository seedNodesRepository;
|
private final SeedNodesRepository seedNodesRepository;
|
||||||
private final int port;
|
private final int port;
|
||||||
|
private final int maxConnections;
|
||||||
private final File torDir;
|
private final File torDir;
|
||||||
private Clock clock;
|
private Clock clock;
|
||||||
private final Optional<EncryptionService> optionalEncryptionService;
|
private final Optional<EncryptionService> optionalEncryptionService;
|
||||||
|
@ -104,8 +106,32 @@ public class P2PService implements SetupListener, MessageListener, ConnectionLis
|
||||||
Clock clock,
|
Clock clock,
|
||||||
@Nullable EncryptionService encryptionService,
|
@Nullable EncryptionService encryptionService,
|
||||||
@Nullable KeyRing keyRing) {
|
@Nullable KeyRing keyRing) {
|
||||||
|
this(
|
||||||
|
seedNodesRepository,
|
||||||
|
port, MAX_CONNECTIONS_DEFAULT,
|
||||||
|
torDir,
|
||||||
|
useLocalhost,
|
||||||
|
networkId,
|
||||||
|
storageDir,
|
||||||
|
clock,
|
||||||
|
encryptionService,
|
||||||
|
keyRing
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@VisibleForTesting
|
||||||
|
public P2PService(SeedNodesRepository seedNodesRepository,
|
||||||
|
int port, int maxConnections,
|
||||||
|
File torDir,
|
||||||
|
boolean useLocalhost,
|
||||||
|
int networkId,
|
||||||
|
File storageDir,
|
||||||
|
Clock clock,
|
||||||
|
@Nullable EncryptionService encryptionService,
|
||||||
|
@Nullable KeyRing keyRing) {
|
||||||
this.seedNodesRepository = seedNodesRepository;
|
this.seedNodesRepository = seedNodesRepository;
|
||||||
this.port = port;
|
this.port = port;
|
||||||
|
this.maxConnections = maxConnections;
|
||||||
this.torDir = torDir;
|
this.torDir = torDir;
|
||||||
this.clock = clock;
|
this.clock = clock;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue