From 51059fe6a9537575781e367d6501e1e724e10b31 Mon Sep 17 00:00:00 2001 From: Ivan Vilata-i-Balaguer Date: Thu, 7 Apr 2016 11:22:33 +0200 Subject: [PATCH 01/15] Remove comma before first argument in string representation --- .../main/java/io/bitsquare/crypto/DecryptedMsgWithPubKey.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/network/src/main/java/io/bitsquare/crypto/DecryptedMsgWithPubKey.java b/network/src/main/java/io/bitsquare/crypto/DecryptedMsgWithPubKey.java index d93d69e5e2..bff6d8899d 100644 --- a/network/src/main/java/io/bitsquare/crypto/DecryptedMsgWithPubKey.java +++ b/network/src/main/java/io/bitsquare/crypto/DecryptedMsgWithPubKey.java @@ -57,7 +57,7 @@ public final class DecryptedMsgWithPubKey implements Persistable { @Override public String toString() { return "DecryptedMsgWithPubKey{" + - ", message=" + message + + "message=" + message + ", signaturePubKey.hashCode()=" + signaturePubKey.hashCode() + '}'; } From e6197938fefedd5dbbefcf1e441b5c93f9c4bad6 Mon Sep 17 00:00:00 2001 From: Ivan Vilata-i-Balaguer Date: Thu, 7 Apr 2016 11:46:24 +0200 Subject: [PATCH 02/15] Read HTTP error stream before closing it It wasn't causing problems, but it looks odd. --- network/src/main/java/io/bitsquare/http/HttpClient.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/network/src/main/java/io/bitsquare/http/HttpClient.java b/network/src/main/java/io/bitsquare/http/HttpClient.java index 73eecc42e4..0c01425274 100644 --- a/network/src/main/java/io/bitsquare/http/HttpClient.java +++ b/network/src/main/java/io/bitsquare/http/HttpClient.java @@ -22,14 +22,15 @@ public class HttpClient { URL url = new URL(baseUrl + param); connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("GET"); - connection.setConnectTimeout(10000); - connection.setReadTimeout(10000); + connection.setConnectTimeout(10_000); + connection.setReadTimeout(10_000); if (connection.getResponseCode() == 200) { return convertInputStreamToString(connection.getInputStream()); } else { + String error = convertInputStreamToString(connection.getErrorStream()); connection.getErrorStream().close(); - throw new HttpException(convertInputStreamToString(connection.getErrorStream())); + throw new HttpException(error); } } finally { if (connection != null) From ad579bf7cc303d4019ebeaa1948c192b8c04ac7b Mon Sep 17 00:00:00 2001 From: Ivan Vilata-i-Balaguer Date: Thu, 7 Apr 2016 13:47:59 +0200 Subject: [PATCH 03/15] Clarify matching of seed node ports and network ids --- .../io/bitsquare/p2p/seed/SeedNodesRepository.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/network/src/main/java/io/bitsquare/p2p/seed/SeedNodesRepository.java b/network/src/main/java/io/bitsquare/p2p/seed/SeedNodesRepository.java index 032193b136..c22d74278c 100644 --- a/network/src/main/java/io/bitsquare/p2p/seed/SeedNodesRepository.java +++ b/network/src/main/java/io/bitsquare/p2p/seed/SeedNodesRepository.java @@ -11,9 +11,10 @@ import java.util.stream.Collectors; public class SeedNodesRepository { private static final Logger log = LoggerFactory.getLogger(SeedNodesRepository.class); - // mainnet use port 8000 - // testnet use port 8001 - // regtest use port 8002 + // Addresses are used if their port match the network id: + // - mainnet uses port 8000 + // - testnet uses port 8001 + // - regtest uses port 8002 private Set torSeedNodeAddresses = Sets.newHashSet( // In alpha we change the network with new releases. That will be faded out once we become backwards compatible (Beta) @@ -51,6 +52,10 @@ public class SeedNodesRepository { new NodeAddress("mfla72c4igh5ta2t.onion:8002") ); + // Addresses are used if the last digit of their port match the network id: + // - mainnet use port ends in 0 + // - testnet use port ends in 1 + // - regtest use port ends in 2 private Set localhostSeedNodeAddresses = Sets.newHashSet( // mainnet new NodeAddress("localhost:2000"), From 0068ffa4160773842de2b24029bdd214954ccc50 Mon Sep 17 00:00:00 2001 From: Ivan Vilata-i-Balaguer Date: Thu, 7 Apr 2016 17:51:24 +0200 Subject: [PATCH 04/15] Some descriptive comments (not JavaDoc) to task classes --- common/src/main/java/io/bitsquare/common/Clock.java | 2 ++ common/src/main/java/io/bitsquare/common/MasterTimer.java | 1 + common/src/main/java/io/bitsquare/common/UserThread.java | 1 + 3 files changed, 4 insertions(+) diff --git a/common/src/main/java/io/bitsquare/common/Clock.java b/common/src/main/java/io/bitsquare/common/Clock.java index 7b878bd783..30548e4f65 100644 --- a/common/src/main/java/io/bitsquare/common/Clock.java +++ b/common/src/main/java/io/bitsquare/common/Clock.java @@ -7,6 +7,8 @@ import java.util.LinkedList; import java.util.List; import java.util.concurrent.TimeUnit; +// Helps configure listener objects that are run by the `UserThread` each second +// and can do per second, per minute and delayed second actions. public class Clock { private static final Logger log = LoggerFactory.getLogger(Clock.class); diff --git a/common/src/main/java/io/bitsquare/common/MasterTimer.java b/common/src/main/java/io/bitsquare/common/MasterTimer.java index a39fc50099..2fc0ed1d6d 100644 --- a/common/src/main/java/io/bitsquare/common/MasterTimer.java +++ b/common/src/main/java/io/bitsquare/common/MasterTimer.java @@ -7,6 +7,7 @@ import java.util.Set; import java.util.TimerTask; import java.util.concurrent.CopyOnWriteArraySet; +// Runs all listener objects periodically in a short interval. public class MasterTimer { private final static Logger log = LoggerFactory.getLogger(MasterTimer.class); private static final java.util.Timer timer = new java.util.Timer(); diff --git a/common/src/main/java/io/bitsquare/common/UserThread.java b/common/src/main/java/io/bitsquare/common/UserThread.java index b40a49b7b7..1edeb726a7 100644 --- a/common/src/main/java/io/bitsquare/common/UserThread.java +++ b/common/src/main/java/io/bitsquare/common/UserThread.java @@ -27,6 +27,7 @@ import java.util.Random; import java.util.concurrent.Executor; import java.util.concurrent.TimeUnit; +// Helps run delayed and periodic actions in the caller thread. public class UserThread { private static final Logger log = LoggerFactory.getLogger(UserThread.class); private static Class timerClass; From c5d760b2a000ed68f9ae35d66c6d679b1ca777e9 Mon Sep 17 00:00:00 2001 From: Ivan Vilata-i-Balaguer Date: Fri, 8 Apr 2016 09:19:24 +0200 Subject: [PATCH 05/15] Replace manual checks with equivalent ``Optional.ofNullable()`` --- network/src/main/java/io/bitsquare/p2p/P2PService.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/network/src/main/java/io/bitsquare/p2p/P2PService.java b/network/src/main/java/io/bitsquare/p2p/P2PService.java index ec70e7de18..48268effeb 100644 --- a/network/src/main/java/io/bitsquare/p2p/P2PService.java +++ b/network/src/main/java/io/bitsquare/p2p/P2PService.java @@ -109,8 +109,8 @@ public class P2PService implements SetupListener, MessageListener, ConnectionLis this.torDir = torDir; this.clock = clock; - optionalEncryptionService = encryptionService == null ? Optional.empty() : Optional.of(encryptionService); - optionalKeyRing = keyRing == null ? Optional.empty() : Optional.of(keyRing); + optionalEncryptionService = Optional.ofNullable(encryptionService); + optionalKeyRing = Optional.ofNullable(keyRing); init(useLocalhost, networkId, storageDir); } From fc4babcfd7a4634c3bc042c2c8171598d6240aa5 Mon Sep 17 00:00:00 2001 From: Ivan Vilata-i-Balaguer Date: Fri, 8 Apr 2016 10:18:52 +0200 Subject: [PATCH 06/15] Fix confusing comment --- network/src/main/java/io/bitsquare/p2p/NodeAddress.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/network/src/main/java/io/bitsquare/p2p/NodeAddress.java b/network/src/main/java/io/bitsquare/p2p/NodeAddress.java index 7e08f0ba1b..ced16e3f17 100644 --- a/network/src/main/java/io/bitsquare/p2p/NodeAddress.java +++ b/network/src/main/java/io/bitsquare/p2p/NodeAddress.java @@ -30,7 +30,7 @@ public final class NodeAddress implements Persistable, Payload { return hostName + ":" + port; } - // We use just a few chars form or address to blur the potential receiver for sent messages + // We use just a few chars from the full address to blur the potential receiver for sent messages public byte[] getAddressPrefixHash() { if (addressPrefixHash == null) addressPrefixHash = Hash.getHash(getFullAddress().substring(0, Math.min(2, getFullAddress().length()))); From 8f7f450429d9bb8bb80109d409c8328bb33487a5 Mon Sep 17 00:00:00 2001 From: Ivan Vilata-i-Balaguer Date: Fri, 8 Apr 2016 10:46:53 +0200 Subject: [PATCH 07/15] Remove comma before first argument in string representation --- network/src/main/java/io/bitsquare/p2p/network/Connection.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/network/src/main/java/io/bitsquare/p2p/network/Connection.java b/network/src/main/java/io/bitsquare/p2p/network/Connection.java index e76af68c10..56c048f6f8 100644 --- a/network/src/main/java/io/bitsquare/p2p/network/Connection.java +++ b/network/src/main/java/io/bitsquare/p2p/network/Connection.java @@ -572,7 +572,7 @@ public class Connection implements MessageListener { @Override public String toString() { return "SharedSpace{" + - ", socket=" + socket + + "socket=" + socket + ", ruleViolations=" + ruleViolations + '}'; } From 9b9fd678a8295fa6358da10c0a838e4fdb8faef8 Mon Sep 17 00:00:00 2001 From: Ivan Vilata-i-Balaguer Date: Mon, 11 Apr 2016 10:02:13 +0200 Subject: [PATCH 08/15] Avoid getting current time on each usage on flooding avoidance computations Also fix some log message wording. --- .../io/bitsquare/p2p/network/Connection.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/network/src/main/java/io/bitsquare/p2p/network/Connection.java b/network/src/main/java/io/bitsquare/p2p/network/Connection.java index 56c048f6f8..2e91683cf5 100644 --- a/network/src/main/java/io/bitsquare/p2p/network/Connection.java +++ b/network/src/main/java/io/bitsquare/p2p/network/Connection.java @@ -167,14 +167,16 @@ public class Connection implements MessageListener { try { Log.traceCall(); // Throttle outbound messages - if (System.currentTimeMillis() - lastSendTimeStamp < 20) { - log.info("We got 2 sendMessage requests in less then 20 ms. We set the thread to sleep " + - "for 50 ms to avoid that we flood our peer. lastSendTimeStamp={}, now={}, elapsed={}", - lastSendTimeStamp, System.currentTimeMillis(), (System.currentTimeMillis() - lastSendTimeStamp)); + long now = System.currentTimeMillis(); + long elapsed = now - lastSendTimeStamp; + if (elapsed < 20) { + log.info("We got 2 sendMessage requests in less than 20 ms. We set the thread to sleep " + + "for 50 ms to avoid flooding our peer. lastSendTimeStamp={}, now={}, elapsed={}", + lastSendTimeStamp, now, elapsed); Thread.sleep(50); } - lastSendTimeStamp = System.currentTimeMillis(); + lastSendTimeStamp = now; String peersNodeAddress = peersNodeAddressOptional.isPresent() ? peersNodeAddressOptional.get().toString() : "null"; int size = ByteArrayUtils.objectToByteArray(message).length; @@ -629,8 +631,8 @@ public class Connection implements MessageListener { long now = System.currentTimeMillis(); long elapsed = now - lastReadTimeStamp; if (elapsed < 10) { - log.info("We got 2 messages received in less then 10 ms. We set the thread to sleep " + - "for 20 ms to avoid that we get flooded from our peer. lastReadTimeStamp={}, now={}, elapsed={}", + log.info("We got 2 messages received in less than 10 ms. We set the thread to sleep " + + "for 20 ms to avoid getting flooded by our peer. lastReadTimeStamp={}, now={}, elapsed={}", lastReadTimeStamp, now, elapsed); Thread.sleep(20); } @@ -796,4 +798,4 @@ public class Connection implements MessageListener { '}'; } } -} \ No newline at end of file +} From 5d78918fb2b21b8d0a4cd83ada5560f2687b3797 Mon Sep 17 00:00:00 2001 From: Ivan Vilata-i-Balaguer Date: Mon, 11 Apr 2016 11:08:08 +0200 Subject: [PATCH 09/15] Extend comment on the role of `Connection.InputHandler` --- .../java/io/bitsquare/p2p/network/Connection.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/network/src/main/java/io/bitsquare/p2p/network/Connection.java b/network/src/main/java/io/bitsquare/p2p/network/Connection.java index 2e91683cf5..de9e11bd0c 100644 --- a/network/src/main/java/io/bitsquare/p2p/network/Connection.java +++ b/network/src/main/java/io/bitsquare/p2p/network/Connection.java @@ -585,7 +585,9 @@ public class Connection implements MessageListener { // InputHandler /////////////////////////////////////////////////////////////////////////////////////////// - // Runs in same thread as Connection + // Runs in same thread as Connection, receives a message, performs several checks on it + // (including throttling limits, validity and statistics) + // and delivers it to the message listener given in the constructor. private static class InputHandler implements Runnable { private static final Logger log = LoggerFactory.getLogger(InputHandler.class); @@ -730,13 +732,13 @@ public class Connection implements MessageListener { if (!(message instanceof KeepAliveMessage)) connection.statistic.updateLastActivityTimestamp(); - // First a seed node gets a message form a peer (PreliminaryDataRequest using - // AnonymousMessage interface) which does not has its hidden service - // published, so does not know its address. As the IncomingConnection does not has the + // First a seed node gets a message from a peer (PreliminaryDataRequest using + // AnonymousMessage interface) which does not have its hidden service + // published, so it does not know its address. As the IncomingConnection does not have the // peersNodeAddress set that connection cannot be used for outgoing messages until we // get the address set. // At the data update message (DataRequest using SendersNodeAddressMessage interface) - // after the HS is published we get the peers address set. + // after the HS is published we get the peer's address set. // There are only those messages used for new connections to a peer: // 1. PreliminaryDataRequest From 1db81e3177184eb78958a0fca401ada434fd3b4d Mon Sep 17 00:00:00 2001 From: Ivan Vilata-i-Balaguer Date: Mon, 11 Apr 2016 11:35:59 +0200 Subject: [PATCH 10/15] More informative warning messages, use constant for number of kept backups --- common/src/main/java/io/bitsquare/storage/FileUtil.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/common/src/main/java/io/bitsquare/storage/FileUtil.java b/common/src/main/java/io/bitsquare/storage/FileUtil.java index 59d1cf30b3..84040b3449 100644 --- a/common/src/main/java/io/bitsquare/storage/FileUtil.java +++ b/common/src/main/java/io/bitsquare/storage/FileUtil.java @@ -14,6 +14,8 @@ import java.util.List; public class FileUtil { private static final Logger log = LoggerFactory.getLogger(FileUtil.class); + /** Number of copies to keep in backup directory. */ + private static final int KEPT_BACKUPS = 10; public static void rollingBackup(File dir, String fileName) { if (dir.exists()) { @@ -30,7 +32,7 @@ public class FileUtil { File backupFileDir = new File(Paths.get(backupDir.getAbsolutePath(), dirName).toString()); if (!backupFileDir.exists()) if (!backupFileDir.mkdir()) - log.warn("make backupFileDir failed"); + log.warn("make backupFileDir failed.\nBackupFileDir=" + backupFileDir.getAbsolutePath()); File backupFile = new File(Paths.get(backupFileDir.getAbsolutePath(), new Date().getTime() + "_" + fileName).toString()); @@ -39,7 +41,7 @@ public class FileUtil { pruneBackup(backupFileDir); } catch (IOException e) { - log.error("Backup key failed " + e.getMessage()); + log.error("Backup key failed: " + e.getMessage()); e.printStackTrace(); } } @@ -51,7 +53,7 @@ public class FileUtil { File[] files = backupDir.listFiles(); if (files != null) { List filesList = Arrays.asList(files); - if (filesList.size() > 10) { + if (filesList.size() > KEPT_BACKUPS) { filesList.sort((o1, o2) -> o1.getName().compareTo(o2.getName())); File file = filesList.get(0); if (file.isFile()) { From 4b5a393911ed49d852103f235042739acfa0c7ce Mon Sep 17 00:00:00 2001 From: Ivan Vilata-i-Balaguer Date: Wed, 13 Apr 2016 11:45:45 +0200 Subject: [PATCH 11/15] Add comment on purging sequence number map --- .../src/main/java/io/bitsquare/p2p/storage/P2PDataStorage.java | 1 + 1 file changed, 1 insertion(+) diff --git a/network/src/main/java/io/bitsquare/p2p/storage/P2PDataStorage.java b/network/src/main/java/io/bitsquare/p2p/storage/P2PDataStorage.java index 12f087d8fb..db375b3d8c 100644 --- a/network/src/main/java/io/bitsquare/p2p/storage/P2PDataStorage.java +++ b/network/src/main/java/io/bitsquare/p2p/storage/P2PDataStorage.java @@ -493,6 +493,7 @@ public class P2PDataStorage implements MessageListener, ConnectionListener { return new ByteArray(Hash.getHash(data)); } + // Get a new map with entries older than 10 days purged from the given map. private HashMap getPurgedSequenceNumberMap(HashMap persisted) { HashMap purged = new HashMap<>(); long maxAgeTs = System.currentTimeMillis() - TimeUnit.DAYS.toMillis(10); From e8d289f577a3a8e5c6c434d75f3ce7bc70737633 Mon Sep 17 00:00:00 2001 From: Ivan Vilata-i-Balaguer Date: Wed, 13 Apr 2016 12:07:33 +0200 Subject: [PATCH 12/15] Add comment about network node start --- network/src/main/java/io/bitsquare/p2p/network/NetworkNode.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/network/src/main/java/io/bitsquare/p2p/network/NetworkNode.java b/network/src/main/java/io/bitsquare/p2p/network/NetworkNode.java index 5b378a38f5..c1f0cdc0b4 100644 --- a/network/src/main/java/io/bitsquare/p2p/network/NetworkNode.java +++ b/network/src/main/java/io/bitsquare/p2p/network/NetworkNode.java @@ -60,6 +60,8 @@ public abstract class NetworkNode implements MessageListener { // API /////////////////////////////////////////////////////////////////////////////////////////// + // Calls this (and other registered) setup listener's ``onTorNodeReady()`` and ``onHiddenServicePublished`` + // when the events happen. abstract public void start(@Nullable SetupListener setupListener); public SettableFuture sendMessage(@NotNull NodeAddress peersNodeAddress, Message message) { From 7a7b33fc767682c61529c40a9b2ad83f1fa0facf Mon Sep 17 00:00:00 2001 From: Ivan Vilata-i-Balaguer Date: Thu, 14 Apr 2016 11:02:50 +0200 Subject: [PATCH 13/15] Add comment about check allowed public keys for adding received message --- .../src/main/java/io/bitsquare/p2p/storage/P2PDataStorage.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/network/src/main/java/io/bitsquare/p2p/storage/P2PDataStorage.java b/network/src/main/java/io/bitsquare/p2p/storage/P2PDataStorage.java index db375b3d8c..4b23cf6d37 100644 --- a/network/src/main/java/io/bitsquare/p2p/storage/P2PDataStorage.java +++ b/network/src/main/java/io/bitsquare/p2p/storage/P2PDataStorage.java @@ -433,6 +433,8 @@ public class P2PDataStorage implements MessageListener, ConnectionListener { return checkSignature(protectedStorageEntry.ownerPubKey, hashOfDataAndSeqNr, protectedStorageEntry.signature); } + // Check that the pubkey of the storage entry matches the allowed pubkey for the addition or removal operation + // in the contained mailbox message, or the pubkey of other kinds of messages. private boolean checkPublicKeys(ProtectedStorageEntry protectedStorageEntry, boolean isAddOperation) { boolean result; if (protectedStorageEntry.getStoragePayload() instanceof MailboxStoragePayload) { From 45b13140994ca53d3b29065d1fb8d643daf6e474 Mon Sep 17 00:00:00 2001 From: Ivan Vilata-i-Balaguer Date: Fri, 15 Apr 2016 08:59:03 +0200 Subject: [PATCH 14/15] Move implicit purge removal period to declared constant --- .../main/java/io/bitsquare/p2p/storage/P2PDataStorage.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/network/src/main/java/io/bitsquare/p2p/storage/P2PDataStorage.java b/network/src/main/java/io/bitsquare/p2p/storage/P2PDataStorage.java index 4b23cf6d37..4111996838 100644 --- a/network/src/main/java/io/bitsquare/p2p/storage/P2PDataStorage.java +++ b/network/src/main/java/io/bitsquare/p2p/storage/P2PDataStorage.java @@ -40,6 +40,8 @@ import java.util.concurrent.TimeUnit; // Run in UserThread public class P2PDataStorage implements MessageListener, ConnectionListener { private static final Logger log = LoggerFactory.getLogger(P2PDataStorage.class); + /** How many days to keep an entry before it is purged. */ + public static final int PURGE_AGE_DAYS = 10; @VisibleForTesting public static int CHECK_TTL_INTERVAL_SEC = Timer.STRESS_TEST ? 5 : 60; @@ -495,10 +497,10 @@ public class P2PDataStorage implements MessageListener, ConnectionListener { return new ByteArray(Hash.getHash(data)); } - // Get a new map with entries older than 10 days purged from the given map. + // Get a new map with entries older than PURGE_AGE_DAYS purged from the given map. private HashMap getPurgedSequenceNumberMap(HashMap persisted) { HashMap purged = new HashMap<>(); - long maxAgeTs = System.currentTimeMillis() - TimeUnit.DAYS.toMillis(10); + long maxAgeTs = System.currentTimeMillis() - TimeUnit.DAYS.toMillis(PURGE_AGE_DAYS); persisted.entrySet().stream().forEach(entry -> { if (entry.getValue().timeStamp > maxAgeTs) purged.put(entry.getKey(), entry.getValue()); From 85283b8fd08fb30364632684747936952238fd52 Mon Sep 17 00:00:00 2001 From: Ivan Vilata-i-Balaguer Date: Fri, 15 Apr 2016 11:25:19 +0200 Subject: [PATCH 15/15] Create some constants for maximum number of connections --- network/src/main/java/io/bitsquare/p2p/seed/SeedNode.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/network/src/main/java/io/bitsquare/p2p/seed/SeedNode.java b/network/src/main/java/io/bitsquare/p2p/seed/SeedNode.java index bc1c65eac7..0775600148 100644 --- a/network/src/main/java/io/bitsquare/p2p/seed/SeedNode.java +++ b/network/src/main/java/io/bitsquare/p2p/seed/SeedNode.java @@ -25,6 +25,8 @@ import static com.google.common.base.Preconditions.checkArgument; public class SeedNode { private static final Logger log = LoggerFactory.getLogger(SeedNode.class); + public static final int MAX_CONNECTIONS_LIMIT = 1000; + public static final int MAX_CONNECTIONS_DEFAULT = 50; private NodeAddress mySeedNodeAddress = new NodeAddress("localhost:8001"); private boolean useLocalhost = false; @@ -66,11 +68,11 @@ public class SeedNode { String arg2 = args[2]; int maxConnections = Integer.parseInt(arg2); log.info("From processArgs: maxConnections=" + maxConnections); - checkArgument(maxConnections < 1000, "maxConnections seems to be a bit too high..."); + checkArgument(maxConnections < MAX_CONNECTIONS_LIMIT, "maxConnections seems to be a bit too high..."); PeerManager.setMaxConnections(maxConnections); } else { // we keep default a higher connection size for seed nodes - PeerManager.setMaxConnections(50); + PeerManager.setMaxConnections(MAX_CONNECTIONS_DEFAULT); } if (args.length > 3) { String arg3 = args[3];