X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fsocketengines%2Fsocketengine_epoll.cpp;h=60b365ee139027a8cd75482157c7e7a8db9536f4;hb=33180223e318c304892b3fa8640f90f1ddf6f4b4;hp=f0a7c20167dde69c955eddfc40960d2ddeb6d5e3;hpb=c0aba5b728b0a921d95ec120aa638dab1520b42f;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/socketengines/socketengine_epoll.cpp b/src/socketengines/socketengine_epoll.cpp index f0a7c2016..60b365ee1 100644 --- a/src/socketengines/socketengine_epoll.cpp +++ b/src/socketengines/socketengine_epoll.cpp @@ -19,11 +19,9 @@ #include "inspircd.h" -#include "exitcodes.h" #include #include -#include /** A specialisation of the SocketEngine class, designed to use linux 2.6 epoll(). */ @@ -38,25 +36,13 @@ namespace void SocketEngine::Init() { - // MAX_DESCRIPTORS is mainly used for display purposes, no problem if getrlimit() fails - struct rlimit limit; - if (!getrlimit(RLIMIT_NOFILE, &limit)) - { - MAX_DESCRIPTORS = limit.rlim_cur; - } + LookupMaxFds(); // 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. EngineHandle = epoll_create(128); - if (EngineHandle == -1) - { - ServerInstance->Logs->Log("SOCKET", LOG_DEFAULT, "ERROR: Could not initialize socket engine: %s", strerror(errno)); - ServerInstance->Logs->Log("SOCKET", LOG_DEFAULT, "ERROR: Your kernel probably does not have the proper features. This is a fatal error, exiting now."); - std::cout << "ERROR: Could not initialize epoll socket engine: " << strerror(errno) << std::endl; - std::cout << "ERROR: Your kernel probably does not have the proper features. This is a fatal error, exiting now." << std::endl; - ServerInstance->QuickExit(EXIT_STATUS_SOCKETENGINE); - } + InitError(); } void SocketEngine::RecoverFromFork() @@ -217,7 +203,6 @@ int SocketEngine::DispatchEvents() eh->SetEventMask(mask); if (ev.events & EPOLLIN) { - stats.ReadEvents++; eh->OnEventHandlerRead(); if (eh != GetRef(fd)) // whoa! we got deleted, better not give out the write event @@ -225,7 +210,6 @@ int SocketEngine::DispatchEvents() } if (ev.events & EPOLLOUT) { - stats.WriteEvents++; eh->OnEventHandlerWrite(); } }