diff options
| author | Mike Buland <eichlan@xagasoft.com> | 2023-07-31 15:17:52 -0700 |
|---|---|---|
| committer | Mike Buland <eichlan@xagasoft.com> | 2023-07-31 15:17:52 -0700 |
| commit | a49af97abf091a32f6ec2c3985aa0890ded65d9c (patch) | |
| tree | 9332acb37ccaa1552bf273d2383d4a0292deea14 /src/stable/server.h | |
| parent | 9a7dde29dc1bc1f699508ad9c0335f4d7abf319f (diff) | |
| download | libbu++-a49af97abf091a32f6ec2c3985aa0890ded65d9c.tar.gz libbu++-a49af97abf091a32f6ec2c3985aa0890ded65d9c.tar.bz2 libbu++-a49af97abf091a32f6ec2c3985aa0890ded65d9c.tar.xz libbu++-a49af97abf091a32f6ec2c3985aa0890ded65d9c.zip | |
Debugging yet, but the new server works.
It at least seems to!
Diffstat (limited to '')
| -rw-r--r-- | src/stable/server.h | 29 |
1 files changed, 22 insertions, 7 deletions
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 @@ | |||
| 10 | 10 | ||
| 11 | #include <stdint.h> | 11 | #include <stdint.h> |
| 12 | 12 | ||
| 13 | #ifndef WIN32 | ||
| 14 | #include <sys/select.h> | ||
| 15 | #endif | ||
| 16 | |||
| 17 | #include "bu/string.h" | 13 | #include "bu/string.h" |
| 18 | #include "bu/list.h" | 14 | #include "bu/list.h" |
| 19 | 15 | ||
| @@ -62,6 +58,7 @@ namespace Bu | |||
| 62 | */ | 58 | */ |
| 63 | class Server | 59 | class Server |
| 64 | { | 60 | { |
| 61 | friend class ServerInterface; | ||
| 65 | public: | 62 | public: |
| 66 | Server( int iIoWorkers=4, int iClientWorkers=8 ); | 63 | Server( int iIoWorkers=4, int iClientWorkers=8 ); |
| 67 | virtual ~Server(); | 64 | virtual ~Server(); |
| @@ -90,8 +87,12 @@ namespace Bu | |||
| 90 | 87 | ||
| 91 | void shutdown(); | 88 | void shutdown(); |
| 92 | 89 | ||
| 93 | private: | 90 | protected: |
| 91 | void clientReadReady( fd iFd ); | ||
| 92 | void clientWriteReady( fd iFd ); | ||
| 94 | void closeClient( fd iSocket ); | 93 | void closeClient( fd iSocket ); |
| 94 | |||
| 95 | private: | ||
| 95 | class SrvClientLink : public Bu::ClientLink | 96 | class SrvClientLink : public Bu::ClientLink |
| 96 | { | 97 | { |
| 97 | public: | 98 | public: |
| @@ -113,6 +114,19 @@ namespace Bu | |||
| 113 | virtual Bu::ClientLink *createLink( Bu::Client *pClient ); | 114 | virtual Bu::ClientLink *createLink( Bu::Client *pClient ); |
| 114 | }; | 115 | }; |
| 115 | 116 | ||
| 117 | class WriteMonitor : public Bu::Thread | ||
| 118 | { | ||
| 119 | public: | ||
| 120 | WriteMonitor( Server &rSrv ); | ||
| 121 | virtual ~WriteMonitor(); | ||
| 122 | |||
| 123 | protected: | ||
| 124 | virtual void run(); | ||
| 125 | |||
| 126 | private: | ||
| 127 | Server &rSrv; | ||
| 128 | }; | ||
| 129 | |||
| 116 | class Event | 130 | class Event |
| 117 | { | 131 | { |
| 118 | public: | 132 | public: |
| @@ -168,9 +182,9 @@ namespace Bu | |||
| 168 | }; | 182 | }; |
| 169 | friend class Bu::Server::ClientWorker; | 183 | friend class Bu::Server::ClientWorker; |
| 170 | 184 | ||
| 185 | class __ServerCore *pCore; | ||
| 171 | int nTimeoutSec; | 186 | int nTimeoutSec; |
| 172 | int nTimeoutUSec; | 187 | int nTimeoutUSec; |
| 173 | fd_set fdActive; | ||
| 174 | typedef Hash<fd,ServerSocket *> SrvHash; | 188 | typedef Hash<fd,ServerSocket *> SrvHash; |
| 175 | SrvHash hServers; | 189 | SrvHash hServers; |
| 176 | typedef Hash<fd,Client *> ClientHash; | 190 | typedef Hash<fd,Client *> ClientHash; |
| @@ -188,7 +202,8 @@ namespace Bu | |||
| 188 | typedef List<ClientWorker *> ClientWorkerList; | 202 | typedef List<ClientWorker *> ClientWorkerList; |
| 189 | IoWorkerList lIoWorker; | 203 | IoWorkerList lIoWorker; |
| 190 | ClientWorkerList lClientWorker; | 204 | ClientWorkerList lClientWorker; |
| 191 | Bu::CounterEvent evIoCycle; | 205 | WriteMonitor tMonitorWrite; |
| 206 | bool bRunning; | ||
| 192 | }; | 207 | }; |
| 193 | } | 208 | } |
| 194 | 209 | ||
