]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/socketengine.h
Convert GetMaxFds() to size_t and deduplicate setting code.
[user/henk/code/inspircd.git] / include / socketengine.h
index fa2f263583846b7746b20f547c706b09dd7055e1..34dd306ba45d5766501ade3a80c4dd075beab9f8 100644 (file)
@@ -266,20 +266,23 @@ class CoreExport SocketEngine
         **/
        static std::vector<EventHandler*> ref;
 
- protected:
-       /** Current number of descriptors in the engine
-        */
+       /** Current number of descriptors in the engine. */
        static size_t CurrentSetSize;
+
+       /** The maximum number of descriptors in the engine. */
+       static size_t MaxSetSize;
+
        /** List of handlers that want a trial read/write
         */
        static std::set<int> trials;
 
-       static int MAX_DESCRIPTORS;
-
        /** Socket engine statistics: count of various events, bandwidth usage
         */
        static Statistics stats;
 
+       /** Look up the fd limit using rlimit. */
+       static void LookupMaxFds();
+
        static void OnSetEvent(EventHandler* eh, int old_mask, int new_mask);
 
        /** Add an event handler to the base socket engine. AddFd(EventHandler*, int) should call this.
@@ -344,10 +347,10 @@ public:
 
        /** Returns the number of file descriptors reported by the system this program may use
         * when it was started.
-        * @return If positive, the number of file descriptors that the system reported that we
-        * may use. Otherwise (<= 0) this number could not be determined.
+        * @return If non-zero the number of file descriptors that the system reported that we
+        * may use.
         */
-       static int GetMaxFds() { return MAX_DESCRIPTORS; }
+       static size_t GetMaxFds() { return MaxSetSize; }
 
        /** Returns the number of file descriptors being queried
         * @return The set size