X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fsocketengine.cpp;h=886e2b0d0fb8b22e5be3adfa371ec89e027bda31;hb=db07867e945deb72ce103f796e20104a27c5f68a;hp=3df9c213512edcbb88e782a27b9154d27a37d836;hpb=85f9d57f0f172c0db12d037ac018d7ff33a64975;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/socketengine.cpp b/src/socketengine.cpp index 3df9c2135..886e2b0d0 100644 --- a/src/socketengine.cpp +++ b/src/socketengine.cpp @@ -28,6 +28,7 @@ #include #include #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);