mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 21:12:48 +01:00
Increase maxconnections limit when using poll.
This commit is contained in:
parent
efec6cc409
commit
bc2c70f44a
@ -1118,8 +1118,13 @@ bool AppInitParameterInteraction()
|
|||||||
|
|
||||||
// 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 described in #2695
|
// <int> in std::min<int>(...) to work around FreeBSD compilation issue described in #2695
|
||||||
nMaxConnections = std::max(std::min<int>(nMaxConnections, FD_SETSIZE - nBind - MIN_CORE_FILEDESCRIPTORS - MAX_ADDNODE_CONNECTIONS), 0);
|
|
||||||
nFD = RaiseFileDescriptorLimit(nMaxConnections + MIN_CORE_FILEDESCRIPTORS + MAX_ADDNODE_CONNECTIONS);
|
nFD = RaiseFileDescriptorLimit(nMaxConnections + MIN_CORE_FILEDESCRIPTORS + MAX_ADDNODE_CONNECTIONS);
|
||||||
|
#ifdef USE_POLL
|
||||||
|
int fd_max = nFD;
|
||||||
|
#else
|
||||||
|
int fd_max = FD_SETSIZE;
|
||||||
|
#endif
|
||||||
|
nMaxConnections = std::max(std::min<int>(nMaxConnections, fd_max - nBind - MIN_CORE_FILEDESCRIPTORS - MAX_ADDNODE_CONNECTIONS), 0);
|
||||||
if (nFD < MIN_CORE_FILEDESCRIPTORS)
|
if (nFD < MIN_CORE_FILEDESCRIPTORS)
|
||||||
return InitError(_("Not enough file descriptors available."));
|
return InitError(_("Not enough file descriptors available."));
|
||||||
nMaxConnections = std::min(nFD - MIN_CORE_FILEDESCRIPTORS - MAX_ADDNODE_CONNECTIONS, nMaxConnections);
|
nMaxConnections = std::min(nFD - MIN_CORE_FILEDESCRIPTORS - MAX_ADDNODE_CONNECTIONS, nMaxConnections);
|
||||||
|
Loading…
Reference in New Issue
Block a user