diff --git a/src/init.cpp b/src/init.cpp index baf81eb0cd..5089df5a62 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1268,6 +1268,8 @@ bool AppInitParameterInteraction(const ArgsManager& args) #else int fd_max = FD_SETSIZE; #endif + // Trim requested connection counts, to fit into system limitations + // in std::min(...) to work around FreeBSD compilation issue described in #2695 nMaxConnections = std::max(std::min(nMaxConnections, fd_max - nBind - MIN_CORE_FILEDESCRIPTORS - MAX_ADDNODE_CONNECTIONS - NUM_FDS_MESSAGE_CAPTURE), 0); if (nFD < MIN_CORE_FILEDESCRIPTORS) return InitError(_("Not enough file descriptors available."));