net: move max/max-outbound to CConnman

This commit is contained in:
Cory Fields
2016-05-22 09:52:03 +02:00
parent 8a593694b1
commit fdf69ff21a
3 changed files with 22 additions and 18 deletions

View File

@@ -861,7 +861,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", DEFAULT_MAX_PEER_CONNECTIONS);
nMaxConnections = std::max(nUserMaxConnections, 0);
int nMaxConnections = std::max(nUserMaxConnections, 0);
// Trim requested connection counts, to fit into system limitations
nMaxConnections = std::max(std::min(nMaxConnections, (int)(FD_SETSIZE - nBind - MIN_CORE_FILEDESCRIPTORS)), 0);
@@ -1509,7 +1509,8 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
StartTorControl(threadGroup, scheduler);
std::string strNodeError;
if(!StartNode(connman, threadGroup, scheduler, nLocalServices, nRelevantServices, strNodeError))
int nMaxOutbound = std::min(MAX_OUTBOUND_CONNECTIONS, nMaxConnections);
if(!StartNode(connman, threadGroup, scheduler, nLocalServices, nRelevantServices, nMaxConnections, nMaxOutbound, strNodeError))
return InitError(strNodeError);
// ********************************************************* Step 12: finished