]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Added extra checking to socketengine to refuse connections after we reach the max
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Thu, 29 Dec 2005 16:33:26 +0000 (16:33 +0000)
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Thu, 29 Dec 2005 16:33:26 +0000 (16:33 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2697 e03df62e-2008-0410-955e-edbf42e46eb7

include/socketengine.h
src/socketengine.cpp

index ecb8fa96e7e0287e91671dcf8ea006993cee99b7..caa4dc45b4a0a36494e0a7bcd9da361a93e4336f 100644 (file)
@@ -67,6 +67,7 @@ const char X_READBIT            = 0x80;
 class SocketEngine {
 
        int EngineHandle;                       /* Handle to the socket engine if needed */
+       int CurrentSetSize;                     /* Current number of descriptors in the engine */
 #ifdef USE_SELECT
        std::map<int,int> fds;                  /* List of file descriptors being monitored */
        fd_set wfdset, rfdset;                  /* Readable and writeable sets for select() */
index 3e0b3814d6ee901d5c849ffc4eeb5311d5542483..69838ff59cfee93fc676be5d376ce542d405203b 100644 (file)
@@ -2,7 +2,7 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  Inspire is copyright (C) 2002-2005 ChatSpike-Dev.
+ *  Inspire is copyright (C) 2002-2006 ChatSpike-Dev.
  *                       E-mail:
  *                <brain@chatspike.net>
  *                <Craig@chatspike.net>
@@ -19,7 +19,6 @@
 #include "inspircd.h"
 #ifdef USE_EPOLL
 #include <sys/epoll.h>
-#define EP_DELAY 5
 #endif
 #ifdef USE_KQUEUE
 #include <sys/types.h>
@@ -67,6 +66,11 @@ bool SocketEngine::AddFd(int fd, bool readable, char type)
 {
        if ((fd < 0) || (fd > 65535))
                return false;
+       if (GetRemainingFds() <= 1)
+       {
+               log(DEFAULT,"ERROR: System out of file descriptors!");
+               return false;
+       }
 #ifdef USE_SELECT
        fds[fd] = fd;
 #endif