From 36def513b0306d5c1fc337883ffaa6a18c2b9dea Mon Sep 17 00:00:00 2001 From: malloc Date: Fri, 13 Apr 2018 08:36:54 -0500 Subject: [PATCH] thick pools --- server/src/sock/pool.hpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/server/src/sock/pool.hpp b/server/src/sock/pool.hpp index b89a6fc..19ab56f 100644 --- a/server/src/sock/pool.hpp +++ b/server/src/sock/pool.hpp @@ -1,6 +1,7 @@ #ifndef SOSC_POOL_H #define SOSC_POOL_H +#include #include #include #include @@ -33,6 +34,8 @@ public: void Start(); bool AddClient(T* client); + int ClientCount() const; + void Stop(); protected: virtual void ProcessClient(T* client) = 0; @@ -86,6 +89,14 @@ bool Pool::AddClient(T* client) { return false; } + +template +int Pool::ClientCount() const { + int count = 0; + for(auto i = this->stacks.begin(); i != this->stacks.end(); ++i) + count += i->ClientCount(); + return count; +} } #endif