X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fsocketengines%2Fsocketengine_epoll.cpp;h=7ca9da3fd8a113472d0ef3498d95247de2228c2c;hb=635cb9d65f6d7f6758ae8ed874da00c8d94b6e39;hp=a935d786b62a16f7df4d8e881a1926d833821fea;hpb=2f64744dd81cd956780160e8568a42cf952df6c8;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/socketengines/socketengine_epoll.cpp b/src/socketengines/socketengine_epoll.cpp index a935d786b..7ca9da3fd 100644 --- a/src/socketengines/socketengine_epoll.cpp +++ b/src/socketengines/socketengine_epoll.cpp @@ -1,8 +1,16 @@ /* * InspIRCd -- Internet Relay Chat Daemon * - * Copyright (C) 2009 Daniel De Graaf - * Copyright (C) 2007-2008 Craig Edwards + * Copyright (C) 2014-2015 Attila Molnar + * Copyright (C) 2014, 2016 Adam + * Copyright (C) 2013, 2017, 2019 Sadie Powell + * Copyright (C) 2012 Robby + * Copyright (C) 2012 Ariadne Conill + * Copyright (C) 2009-2010 Daniel De Graaf + * Copyright (C) 2008 Thomas Stagner + * Copyright (C) 2007-2008 Dennis Friis + * Copyright (C) 2006-2008 Craig Edwards + * Copyright (C) 2006, 2008 Robin Burchell * * This file is part of InspIRCd. InspIRCd is free software: you can * redistribute it and/or modify it under the terms of the GNU General Public @@ -19,11 +27,9 @@ #include "inspircd.h" -#include "exitcodes.h" #include -#include -#include +#include /** A specialisation of the SocketEngine class, designed to use linux 2.6 epoll(). */ @@ -33,26 +39,18 @@ namespace /** These are used by epoll() to hold socket events */ - std::vector events(1); + std::vector events(16); } void SocketEngine::Init() { - // MAX_DESCRIPTORS is mainly used for display purposes, no problem if ulimit() fails and returns a negative number - MAX_DESCRIPTORS = ulimit(4, 0); + 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()