X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=include%2Fsocketengine.h;fp=include%2Fsocketengine.h;h=34dd306ba45d5766501ade3a80c4dd075beab9f8;hb=b1098712771ab823042fcf8614a706c76c2ff401;hp=fa2f263583846b7746b20f547c706b09dd7055e1;hpb=d4414f54910aeaa4809a7eacea75a089a0820f40;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/include/socketengine.h b/include/socketengine.h index fa2f26358..34dd306ba 100644 --- a/include/socketengine.h +++ b/include/socketengine.h @@ -266,20 +266,23 @@ class CoreExport SocketEngine **/ static std::vector 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 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