|
|
@ -976,10 +976,10 @@ 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); |
|
|
|
nMaxConnections = GetArg("-maxconnections", DEFAULT_MAX_PEER_CONNECTIONS); |
|
|
|
fprintf(stderr,"nMaxConnections %d\n",nMaxConnections); |
|
|
|
//fprintf(stderr,"nMaxConnections %d\n",nMaxConnections);
|
|
|
|
nMaxConnections = std::max(std::min(nMaxConnections, (int)(FD_SETSIZE - nBind - MIN_CORE_FILEDESCRIPTORS)), 0); |
|
|
|
int nFD = RaiseFileDescriptorLimit(nMaxConnections + MIN_CORE_FILEDESCRIPTORS); |
|
|
|
fprintf(stderr,"nMaxConnections %d\n",nMaxConnections); |
|
|
|
fprintf(stderr,"nMaxConnections %d FD_SETSIZE.%d nBind.%d expr.%d \n",nMaxConnections,FD_SETSIZE,nBind,(int)(FD_SETSIZE - nBind - MIN_CORE_FILEDESCRIPTORS)); |
|
|
|
if (nFD < MIN_CORE_FILEDESCRIPTORS) |
|
|
|
return InitError(_("Not enough file descriptors available.")); |
|
|
|
if (nFD - MIN_CORE_FILEDESCRIPTORS < nMaxConnections) |
|
|
|