Skip to content

Commit 586a292

Browse files
committed
Merge pull request #6503
19dd40a Consolidate individual references to the current maximum peer connection value of 125 into a single constant declaration. (Matt Quinn)
2 parents b6fee6b + 19dd40a commit 586a292

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

src/init.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ std::string HelpMessage(HelpMessageMode mode)
314314
strUsage += HelpMessageOpt("-externalip=<ip>", _("Specify your own public address"));
315315
strUsage += HelpMessageOpt("-forcednsseed", strprintf(_("Always query for peer addresses via DNS lookup (default: %u)"), 0));
316316
strUsage += HelpMessageOpt("-listen", _("Accept connections from outside (default: 1 if no -proxy or -connect)"));
317-
strUsage += HelpMessageOpt("-maxconnections=<n>", strprintf(_("Maintain at most <n> connections to peers (default: %u)"), 125));
317+
strUsage += HelpMessageOpt("-maxconnections=<n>", strprintf(_("Maintain at most <n> connections to peers (default: %u)"), DEFAULT_MAX_PEER_CONNECTIONS));
318318
strUsage += HelpMessageOpt("-maxreceivebuffer=<n>", strprintf(_("Maximum per-connection receive buffer, <n>*1000 bytes (default: %u)"), 5000));
319319
strUsage += HelpMessageOpt("-maxsendbuffer=<n>", strprintf(_("Maximum per-connection send buffer, <n>*1000 bytes (default: %u)"), 1000));
320320
strUsage += HelpMessageOpt("-onion=<ip:port>", strprintf(_("Use separate SOCKS5 proxy to reach peers via Tor hidden services (default: %s)"), "-proxy"));
@@ -752,7 +752,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
752752

753753
// Make sure enough file descriptors are available
754754
int nBind = std::max((int)mapArgs.count("-bind") + (int)mapArgs.count("-whitebind"), 1);
755-
int nUserMaxConnections = GetArg("-maxconnections", 125);
755+
int nUserMaxConnections = GetArg("-maxconnections", DEFAULT_MAX_PEER_CONNECTIONS);
756756
nMaxConnections = std::max(nUserMaxConnections, 0);
757757
int nUserWhiteConnections = GetArg("-whiteconnections", 0);
758758
nWhiteConnections = std::max(nUserWhiteConnections, 0);

src/net.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ static CNode* pnodeLocalHost = NULL;
8080
uint64_t nLocalHostNonce = 0;
8181
static std::vector<ListenSocket> vhListenSocket;
8282
CAddrMan addrman;
83-
int nMaxConnections = 125;
83+
int nMaxConnections = DEFAULT_MAX_PEER_CONNECTIONS;
8484
int nWhiteConnections = 0;
8585
bool fAddressesInitialized = false;
8686

src/net.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ static const bool DEFAULT_UPNP = false;
5656
#endif
5757
/** The maximum number of entries in mapAskFor */
5858
static const size_t MAPASKFOR_MAX_SZ = MAX_INV_SZ;
59+
/** The maximum number of peer connections to maintain. */
60+
static const unsigned int DEFAULT_MAX_PEER_CONNECTIONS = 125;
5961

6062
unsigned int ReceiveFloodSize();
6163
unsigned int SendBufferSize();

0 commit comments

Comments
 (0)