diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/configreader.cpp | 3 | ||||
-rw-r--r-- | src/socketengines/socketengine_epoll.cpp | 13 | ||||
-rw-r--r-- | src/socketengines/socketengine_kqueue.cpp | 7 | ||||
-rw-r--r-- | src/socketengines/socketengine_poll.cpp | 6 | ||||
-rw-r--r-- | src/socketengines/socketengine_ports.cpp | 14 |
5 files changed, 9 insertions, 34 deletions
diff --git a/src/configreader.cpp b/src/configreader.cpp index 77f61c978..15d9298b6 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -36,7 +36,6 @@ ServerConfig::ServerConfig() dns_timeout = 5; MaxTargets = 20; NetBufferSize = 10240; - SoftLimit = SocketEngine::GetMaxFds(); MaxConn = SOMAXCONN; MaxChans = 20; OperMaxChans = 30; @@ -366,7 +365,7 @@ void ServerConfig::Fill() if (!nsid.empty() && nsid != sid) throw CoreException("You must restart to change the server id"); } - SoftLimit = ConfValue("performance")->getInt("softlimit", SocketEngine::GetMaxFds(), 10, SocketEngine::GetMaxFds()); + SoftLimit = ConfValue("performance")->getInt("softlimit", (SocketEngine::GetMaxFds() > 0 ? SocketEngine::GetMaxFds() : LONG_MAX), 10); CCOnConnect = ConfValue("performance")->getBool("clonesonconnect", true); MaxConn = ConfValue("performance")->getInt("somaxconn", SOMAXCONN); XLineMessage = options->getString("xlinemessage", options->getString("moronbanner", "You're banned!")); diff --git a/src/socketengines/socketengine_epoll.cpp b/src/socketengines/socketengine_epoll.cpp index 1c4d8963d..7d919ec9f 100644 --- a/src/socketengines/socketengine_epoll.cpp +++ b/src/socketengines/socketengine_epoll.cpp @@ -42,17 +42,8 @@ namespace void SocketEngine::Init() { - int max = ulimit(4, 0); - if (max > 0) - { - MAX_DESCRIPTORS = max; - } - else - { - ServerInstance->Logs->Log("SOCKET", LOG_DEFAULT, "ERROR: Can't determine maximum number of open sockets!"); - std::cout << "ERROR: Can't determine maximum number of open sockets!" << std::endl; - ServerInstance->QuickExit(EXIT_STATUS_SOCKETENGINE); - } + // MAX_DESCRIPTORS is mainly used for display purposes, no problem if ulimit() fails and returns a negative number + MAX_DESCRIPTORS = ulimit(4, 0); // 128 is not a maximum, just a hint at the eventual number of sockets that may be polled, // and it is completely ignored by 2.6.8 and later kernels, except it must be larger than zero. diff --git a/src/socketengines/socketengine_kqueue.cpp b/src/socketengines/socketengine_kqueue.cpp index 68c1bda8c..d5a3bb793 100644 --- a/src/socketengines/socketengine_kqueue.cpp +++ b/src/socketengines/socketengine_kqueue.cpp @@ -58,13 +58,8 @@ void SocketEngine::Init() mib[1] = KERN_MAXFILES; #endif len = sizeof(MAX_DESCRIPTORS); + // MAX_DESCRIPTORS is mainly used for display purposes, no problem if the sysctl() below fails sysctl(mib, 2, &MAX_DESCRIPTORS, &len, NULL, 0); - if (MAX_DESCRIPTORS <= 0) - { - ServerInstance->Logs->Log("SOCKET", LOG_DEFAULT, "ERROR: Can't determine maximum number of open sockets!"); - std::cout << "ERROR: Can't determine maximum number of open sockets!" << std::endl; - ServerInstance->QuickExit(EXIT_STATUS_SOCKETENGINE); - } RecoverFromFork(); } diff --git a/src/socketengines/socketengine_poll.cpp b/src/socketengines/socketengine_poll.cpp index 4eca494cf..4e6d0b9f5 100644 --- a/src/socketengines/socketengine_poll.cpp +++ b/src/socketengines/socketengine_poll.cpp @@ -21,7 +21,6 @@ */ -#include <iostream> #include <vector> #include <string> #include <map> @@ -53,9 +52,8 @@ void SocketEngine::Init() } else { - ServerInstance->Logs->Log("SOCKET", LOG_DEFAULT, "ERROR: Can't determine maximum number of open sockets: %s", strerror(errno)); - std::cout << "ERROR: Can't determine maximum number of open sockets: " << strerror(errno) << std::endl; - ServerInstance->QuickExit(EXIT_STATUS_SOCKETENGINE); + // MAX_DESCRIPTORS is mainly used for display purposes, it's not a problem that getrlimit() failed + MAX_DESCRIPTORS = -1; } } diff --git a/src/socketengines/socketengine_ports.cpp b/src/socketengines/socketengine_ports.cpp index deafd8fcb..c6ddb041c 100644 --- a/src/socketengines/socketengine_ports.cpp +++ b/src/socketengines/socketengine_ports.cpp @@ -48,17 +48,9 @@ namespace */ void SocketEngine::Init() { - int max = ulimit(4, 0); - if (max > 0) - { - MAX_DESCRIPTORS = max; - } - else - { - ServerInstance->Logs->Log("SOCKET", LOG_DEFAULT, "ERROR: Can't determine maximum number of open sockets!"); - std::cout << "ERROR: Can't determine maximum number of open sockets!" << std::endl; - ServerInstance->QuickExit(EXIT_STATUS_SOCKETENGINE); - } + // MAX_DESCRIPTORS is mainly used for display purposes, no problem if ulimit() fails and returns a negative number + MAX_DESCRIPTORS = ulimit(4, 0); + EngineHandle = port_create(); if (EngineHandle == -1) |