Fix calculation of number of bound sockets to use

Github-Pull: #9253
Rebased-From: 9e1f46821d5bb69e2cbf25738eefa7c6cb99c838
This commit is contained in:
Matt Corallo
2016-11-29 17:49:08 -08:00
committed by lateminer
parent 62de6f69d5
commit 39e1d793ce

View File

@@ -865,7 +865,9 @@ bool AppInit2(Config& config, boost::thread_group& threadGroup, CScheduler& sche
}
// Make sure enough file descriptors are available
int nBind = std::max((int)mapArgs.count("-bind") + (int)mapArgs.count("-whitebind"), 1);
int nBind = std::max(
(mapMultiArgs.count("-bind") ? mapMultiArgs.at("-bind").size() : 0) +
(mapMultiArgs.count("-whitebind") ? mapMultiArgs.at("-whitebind").size() : 0), size_t(1));
int nUserMaxConnections = GetArg("-maxconnections", DEFAULT_MAX_PEER_CONNECTIONS);
nMaxConnections = std::max(nUserMaxConnections, 0);