aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatt Quinn <matt@mattjquinn.com>2015-08-01 10:41:21 -0700
committerMatt Quinn <matt@mattjquinn.com>2015-08-03 14:37:00 -0700
commit19dd40a25f061fb8b16b9332826293f5d0b58a56 (patch)
tree6aca0a8e726c4c3a5fb8d8060c0970c06abf94d4 /src
parent219b916545f3be194eb53801bfb8d0694978fb00 (diff)
Consolidate individual references to the current maximum peer connection
value of 125 into a single constant declaration.
Diffstat (limited to 'src')
-rw-r--r--src/init.cpp4
-rw-r--r--src/net.cpp2
-rw-r--r--src/net.h2
3 files changed, 5 insertions, 3 deletions
diff --git a/src/init.cpp b/src/init.cpp
index 6bea42a20e..d4ec04aae6 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -314,7 +314,7 @@ std::string HelpMessage(HelpMessageMode mode)
strUsage += HelpMessageOpt("-externalip=<ip>", _("Specify your own public address"));
strUsage += HelpMessageOpt("-forcednsseed", strprintf(_("Always query for peer addresses via DNS lookup (default: %u)"), 0));
strUsage += HelpMessageOpt("-listen", _("Accept connections from outside (default: 1 if no -proxy or -connect)"));
- strUsage += HelpMessageOpt("-maxconnections=<n>", strprintf(_("Maintain at most <n> connections to peers (default: %u)"), 125));
+ strUsage += HelpMessageOpt("-maxconnections=<n>", strprintf(_("Maintain at most <n> connections to peers (default: %u)"), DEFAULT_MAX_PEER_CONNECTIONS));
strUsage += HelpMessageOpt("-maxreceivebuffer=<n>", strprintf(_("Maximum per-connection receive buffer, <n>*1000 bytes (default: %u)"), 5000));
strUsage += HelpMessageOpt("-maxsendbuffer=<n>", strprintf(_("Maximum per-connection send buffer, <n>*1000 bytes (default: %u)"), 1000));
strUsage += HelpMessageOpt("-onion=<ip:port>", strprintf(_("Use separate SOCKS5 proxy to reach peers via Tor hidden services (default: %s)"), "-proxy"));
@@ -750,7 +750,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
// Make sure enough file descriptors are available
int nBind = std::max((int)mapArgs.count("-bind") + (int)mapArgs.count("-whitebind"), 1);
- int nUserMaxConnections = GetArg("-maxconnections", 125);
+ int nUserMaxConnections = GetArg("-maxconnections", DEFAULT_MAX_PEER_CONNECTIONS);
nMaxConnections = std::max(nUserMaxConnections, 0);
int nUserWhiteConnections = GetArg("-whiteconnections", 0);
nWhiteConnections = std::max(nUserWhiteConnections, 0);
diff --git a/src/net.cpp b/src/net.cpp
index 176fd7195b..5d413697bf 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -80,7 +80,7 @@ static CNode* pnodeLocalHost = NULL;
uint64_t nLocalHostNonce = 0;
static std::vector<ListenSocket> vhListenSocket;
CAddrMan addrman;
-int nMaxConnections = 125;
+int nMaxConnections = DEFAULT_MAX_PEER_CONNECTIONS;
int nWhiteConnections = 0;
bool fAddressesInitialized = false;
diff --git a/src/net.h b/src/net.h
index 658f586b12..aac28fe105 100644
--- a/src/net.h
+++ b/src/net.h
@@ -56,6 +56,8 @@ static const bool DEFAULT_UPNP = false;
#endif
/** The maximum number of entries in mapAskFor */
static const size_t MAPASKFOR_MAX_SZ = MAX_INV_SZ;
+/** The maximum number of peer connections to maintain. */
+static const unsigned int DEFAULT_MAX_PEER_CONNECTIONS = 125;
unsigned int ReceiveFloodSize();
unsigned int SendBufferSize();