]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/socketengine_iocp.cpp
m_testcommand deletes its command handler manually, no modules should do this. Will...
[user/henk/code/inspircd.git] / src / socketengine_iocp.cpp
index 0f1e7e9afd6f03c17747b92389f48310068e0ddb..ff1c7a0bc029d1390d2a3ba29e8642594929ffda 100644 (file)
@@ -12,6 +12,7 @@
  */
 
 #include "socketengine_iocp.h"
+#include "exitcodes.h"
 #include <mswsock.h>
 
 IOCPEngine::IOCPEngine(InspIRCd * Instance) : SocketEngine(Instance)
@@ -19,6 +20,15 @@ IOCPEngine::IOCPEngine(InspIRCd * Instance) : SocketEngine(Instance)
        /* Create completion port */
        m_completionPort = CreateIoCompletionPort(INVALID_HANDLE_VALUE, NULL, (ULONG_PTR)0, 0);
 
+        if (!m_completionPort)
+       {
+               ServerInstance->Log(SPARSE,"ERROR: Could not initialize socket engine. Your kernel probably does not have the proper features.");
+               ServerInstance->Log(SPARSE,"ERROR: this is a fatal error, exiting now.");
+               printf("ERROR: Could not initialize socket engine. Your kernel probably does not have the proper features.");
+               printf("ERROR: this is a fatal error, exiting now.");
+               InspIRCd::Exit(EXIT_STATUS_SOCKETENGINE);
+       }
+
        /* Null variables out. */
        CurrentSetSize = 0;
        EngineHandle = 0;
@@ -41,7 +51,7 @@ bool IOCPEngine::AddFd(EventHandler* eh)
        int opt_len = sizeof(int);
 
        /* In range? */
-       if ((fake_fd < 0) || (fake_fd > MAX_DESCRIPTOR))
+       if ((fake_fd < 0) || (fake_fd > MAX_DESCRIPTORS))
                return false;
 
        /* Already an entry here */
@@ -166,7 +176,7 @@ bool IOCPEngine::PostCompletionEvent(EventHandler * eh, SocketIOEvent type, int
 void IOCPEngine::PostReadEvent(EventHandler * eh)
 {
        if (!eh)
-               return false;
+               return;
 
        Overlapped * ov = new Overlapped(SOCKET_IO_EVENT_READ_READY, 0);
        DWORD flags = 0;