]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/socketengines/socketengine_epoll.cpp
Deduplicate error handling in the socket engines.
[user/henk/code/inspircd.git] / src / socketengines / socketengine_epoll.cpp
index dc10a3613ce7c5c22b117afa1a35ed621a5149f0..60b365ee139027a8cd75482157c7e7a8db9536f4 100644 (file)
 
 
 #include "inspircd.h"
-#include "exitcodes.h"
 
 #include <sys/epoll.h>
 #include <sys/resource.h>
-#include <iostream>
 
 /** A specialisation of the SocketEngine class, designed to use linux 2.6 epoll().
  */
@@ -43,15 +41,8 @@ void SocketEngine::Init()
        // 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()