Changeset View
Changeset View
Standalone View
Standalone View
src/init.cpp
Show First 20 Lines • Show All 1,738 Lines • ▼ Show 20 Lines | bool AppInitParameterInteraction(Config &config) { | ||||
int nBind = std::max(nUserBind, size_t(1)); | int nBind = std::max(nUserBind, size_t(1)); | ||||
nUserMaxConnections = | nUserMaxConnections = | ||||
gArgs.GetArg("-maxconnections", DEFAULT_MAX_PEER_CONNECTIONS); | gArgs.GetArg("-maxconnections", DEFAULT_MAX_PEER_CONNECTIONS); | ||||
nMaxConnections = std::max(nUserMaxConnections, 0); | nMaxConnections = std::max(nUserMaxConnections, 0); | ||||
// Trim requested connection counts, to fit into system limitations | // Trim requested connection counts, to fit into system limitations | ||||
// <int> in std::min<int>(...) to work around FreeBSD compilation issue | // <int> in std::min<int>(...) to work around FreeBSD compilation issue | ||||
// described in #2695 | // described in #2695 | ||||
nFD = RaiseFileDescriptorLimit(nMaxConnections + MIN_CORE_FILEDESCRIPTORS + | nFD = RaiseFileDescriptorLimit(nMaxConnections + nBind + | ||||
MIN_CORE_FILEDESCRIPTORS + | |||||
MAX_ADDNODE_CONNECTIONS); | MAX_ADDNODE_CONNECTIONS); | ||||
#ifdef USE_POLL | #ifdef USE_POLL | ||||
int fd_max = nFD; | int fd_max = nFD; | ||||
#else | #else | ||||
int fd_max = FD_SETSIZE; | int fd_max = FD_SETSIZE; | ||||
#endif | #endif | ||||
nMaxConnections = | nMaxConnections = | ||||
std::max(std::min<int>(nMaxConnections, fd_max - nBind - | std::max(std::min<int>(nMaxConnections, fd_max - nBind - | ||||
▲ Show 20 Lines • Show All 1,140 Lines • Show Last 20 Lines |