Browse Source

Merge pull request #2695 from robbak/init_cpp-explicit_cast

Explictly cast calculation to int, to allow std::min to work.
0.10
Pieter Wuille 12 years ago
parent
commit
d315eb0a76
  1. 2
      src/init.cpp

2
src/init.cpp

@ -531,7 +531,7 @@ bool AppInit2(boost::thread_group& threadGroup) @@ -531,7 +531,7 @@ bool AppInit2(boost::thread_group& threadGroup)
// Make sure enough file descriptors are available
int nBind = std::max((int)mapArgs.count("-bind"), 1);
nMaxConnections = GetArg("-maxconnections", 125);
nMaxConnections = std::max(std::min(nMaxConnections, FD_SETSIZE - nBind - MIN_CORE_FILEDESCRIPTORS), 0);
nMaxConnections = std::max(std::min(nMaxConnections, (int)(FD_SETSIZE - nBind - MIN_CORE_FILEDESCRIPTORS)), 0);
int nFD = RaiseFileDescriptorLimit(nMaxConnections + MIN_CORE_FILEDESCRIPTORS);
if (nFD < MIN_CORE_FILEDESCRIPTORS)
return InitError(_("Not enough file descriptors available."));

Loading…
Cancel
Save