aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPatrick Strateman <patrick.strateman@gmail.com>2018-11-13 14:09:05 -0500
committerPatrick Strateman <patrick.strateman@gmail.com>2018-12-03 14:25:55 -0500
commit4927bf2f257ac53569978980eaf1f61c2c6b04cc (patch)
tree7b99b83bc09d4d4c7f5d97a39ee5a2d7b953031c /src
parent11cc491a288a73e911be24a285e12abd57df7d04 (diff)
Increase maxconnections limit when using poll.
Diffstat (limited to 'src')
-rw-r--r--src/init.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/init.cpp b/src/init.cpp
index 31212a355b..6a49fdbc62 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -952,8 +952,13 @@ bool AppInitParameterInteraction()
// Trim requested connection counts, to fit into system limitations
// <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);
+#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)
return InitError(_("Not enough file descriptors available."));
nMaxConnections = std::min(nFD - MIN_CORE_FILEDESCRIPTORS - MAX_ADDNODE_CONNECTIONS, nMaxConnections);