]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/socketengine_epoll.cpp
This fixes a deletion error here, we were using new[] and not using delete[], but...
[user/henk/code/inspircd.git] / src / socketengine_epoll.cpp
index 8f346cf3a03c14b2a7354a5f47f407cf06f05c1f..97efec1277b508b53aaae9464316e7fad19efdca 100644 (file)
@@ -22,18 +22,18 @@ EPollEngine::EPollEngine(InspIRCd* Instance) : SocketEngine(Instance)
 
        if (EngineHandle == -1)
        {
-               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);
+               ServerInstance->Log(SPARSE,"ERROR: Could not initialize socket engine: %s", strerror(errno));
+               ServerInstance->Log(SPARSE,"ERROR: Your kernel probably does not have the proper features. This is a fatal error, exiting now.");
+               printf("ERROR: Could not initialize socket engine: %s\n", strerror(errno));
+               printf("ERROR: Your kernel probably does not have the proper features. This is a fatal error, exiting now.\n");
+               ServerInstance->Exit(EXIT_STATUS_SOCKETENGINE);
        }
        CurrentSetSize = 0;
 }
 
 EPollEngine::~EPollEngine()
 {
-       close(EngineHandle);
+       this->Close(EngineHandle);
 }
 
 bool EPollEngine::AddFd(EventHandler* eh)
@@ -48,7 +48,6 @@ bool EPollEngine::AddFd(EventHandler* eh)
        if (ref[fd])
                return false;
 
-       ref[fd] = eh;
        struct epoll_event ev;
        memset(&ev,0,sizeof(struct epoll_event));
        eh->Readable() ? ev.events = EPOLLIN : ev.events = EPOLLOUT;
@@ -60,6 +59,8 @@ bool EPollEngine::AddFd(EventHandler* eh)
        }
 
        ServerInstance->Log(DEBUG,"New file descriptor: %d", fd);
+
+       ref[fd] = eh;
        CurrentSetSize++;
        return true;
 }