|
62 | 62 | #include "llmq/quorums_init.h" |
63 | 63 |
|
64 | 64 | #include <stdint.h> |
| 65 | +#include <sys/resource.h> |
65 | 66 | #include <stdio.h> |
66 | 67 | #include <memory> |
67 | 68 |
|
@@ -1070,9 +1071,9 @@ void InitLogging() { |
1070 | 1071 | namespace { // Variables internal to initialization process only |
1071 | 1072 |
|
1072 | 1073 | ServiceFlags nRelevantServices = NODE_NETWORK; |
1073 | | -int nMaxConnections; |
1074 | | -int nUserMaxConnections; |
1075 | | -int nFD; |
| 1074 | +rlim_t nMaxConnections; |
| 1075 | +rlim_t nUserMaxConnections; |
| 1076 | +rlim_t nFD; |
1076 | 1077 | ServiceFlags nLocalServices = NODE_NETWORK; |
1077 | 1078 |
|
1078 | 1079 | } |
@@ -1168,10 +1169,10 @@ bool AppInitParameterInteraction() |
1168 | 1169 | (mapMultiArgs.count("-bind") ? mapMultiArgs.at("-bind").size() : 0) + |
1169 | 1170 | (mapMultiArgs.count("-whitebind") ? mapMultiArgs.at("-whitebind").size() : 0), size_t(1)); |
1170 | 1171 | nUserMaxConnections = GetArg("-maxconnections", DEFAULT_MAX_PEER_CONNECTIONS); |
1171 | | - nMaxConnections = std::max(nUserMaxConnections, 0); |
| 1172 | + nMaxConnections = std::max(nUserMaxConnections, (rlim_t)0); |
1172 | 1173 |
|
1173 | 1174 | // Trim requested connection counts, to fit into system limitations |
1174 | | - nMaxConnections = std::max(std::min(nMaxConnections, (int)(FD_SETSIZE - nBind - MIN_CORE_FILEDESCRIPTORS - MAX_ADDNODE_CONNECTIONS)), 0); |
| 1175 | + nMaxConnections = std::max(std::min(nMaxConnections, (rlim_t)(FD_SETSIZE - nBind - MIN_CORE_FILEDESCRIPTORS - MAX_ADDNODE_CONNECTIONS)), (rlim_t)0); |
1175 | 1176 | nFD = RaiseFileDescriptorLimit(nMaxConnections + MIN_CORE_FILEDESCRIPTORS + MAX_ADDNODE_CONNECTIONS); |
1176 | 1177 | if (nFD < MIN_CORE_FILEDESCRIPTORS) |
1177 | 1178 | return InitError(_("Not enough file descriptors available.")); |
|
0 commit comments