From a49af97abf091a32f6ec2c3985aa0890ded65d9c Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Mon, 31 Jul 2023 15:17:52 -0700 Subject: Debugging yet, but the new server works. It at least seems to! --- src/stable/server.h | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) (limited to 'src/stable/server.h') diff --git a/src/stable/server.h b/src/stable/server.h index e2b7d53..56ac29a 100644 --- a/src/stable/server.h +++ b/src/stable/server.h @@ -10,10 +10,6 @@ #include -#ifndef WIN32 - #include -#endif - #include "bu/string.h" #include "bu/list.h" @@ -62,6 +58,7 @@ namespace Bu */ class Server { + friend class ServerInterface; public: Server( int iIoWorkers=4, int iClientWorkers=8 ); virtual ~Server(); @@ -90,8 +87,12 @@ namespace Bu void shutdown(); - private: + protected: + void clientReadReady( fd iFd ); + void clientWriteReady( fd iFd ); void closeClient( fd iSocket ); + + private: class SrvClientLink : public Bu::ClientLink { public: @@ -113,6 +114,19 @@ namespace Bu virtual Bu::ClientLink *createLink( Bu::Client *pClient ); }; + class WriteMonitor : public Bu::Thread + { + public: + WriteMonitor( Server &rSrv ); + virtual ~WriteMonitor(); + + protected: + virtual void run(); + + private: + Server &rSrv; + }; + class Event { public: @@ -168,9 +182,9 @@ namespace Bu }; friend class Bu::Server::ClientWorker; + class __ServerCore *pCore; int nTimeoutSec; int nTimeoutUSec; - fd_set fdActive; typedef Hash SrvHash; SrvHash hServers; typedef Hash ClientHash; @@ -188,7 +202,8 @@ namespace Bu typedef List ClientWorkerList; IoWorkerList lIoWorker; ClientWorkerList lClientWorker; - Bu::CounterEvent evIoCycle; + WriteMonitor tMonitorWrite; + bool bRunning; }; } -- cgit v1.2.3