]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/socketengine.cpp
Fix all typos (not as fun as 'kill all humans' but meh, beggers cant be choosers)
[user/henk/code/inspircd.git] / src / socketengine.cpp
index 3df9c213512edcbb88e782a27b9154d27a37d836..886e2b0d0fb8b22e5be3adfa371ec89e027bda31 100644 (file)
@@ -28,6 +28,7 @@
 #include <vector>
 #include <string>
 #include "socketengine.h"
+#include "helperfuncs.h"
 
 char ref[MAX_DESCRIPTORS];
 
@@ -40,6 +41,17 @@ SocketEngine::SocketEngine()
 #ifdef USE_KQUEUE
        EngineHandle = kqueue();
 #endif
+#ifdef USE_SELECT
+       EngineHandle = 0;
+#endif
+       if (EngineHandle == -1)
+       {
+               log(SPARSE,"ERROR: Could not initialize socket engine. Your kernel probably does not have the proper features.");
+               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.");
+               Exit(0);
+       }
        CurrentSetSize = 0;
 }
 
@@ -112,6 +124,13 @@ bool SocketEngine::AddFd(int fd, bool readable, char type)
        return true;
 }
 
+bool SocketEngine::HasFd(int fd)
+{
+       if ((fd < 0) || (fd > MAX_DESCRIPTORS))
+               return false;
+       return (ref[fd] != 0);
+}
+
 bool SocketEngine::DelFd(int fd)
 {
        log(DEBUG,"SocketEngine::DelFd(%d)",fd);