diff options
Diffstat (limited to 'src/unstable/itoserver.h')
| -rw-r--r-- | src/unstable/itoserver.h | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/unstable/itoserver.h b/src/unstable/itoserver.h index 57fece3..6a0df56 100644 --- a/src/unstable/itoserver.h +++ b/src/unstable/itoserver.h | |||
| @@ -58,13 +58,19 @@ namespace Bu | |||
| 58 | ItoServer(); | 58 | ItoServer(); |
| 59 | virtual ~ItoServer(); | 59 | virtual ~ItoServer(); |
| 60 | 60 | ||
| 61 | #ifdef WIN32 | ||
| 62 | typedef unsigned int socket_t; | ||
| 63 | #else | ||
| 64 | typedef int socket_t; | ||
| 65 | #endif | ||
| 66 | |||
| 61 | void addPort( int nPort, int nPoolSize=40 ); | 67 | void addPort( int nPort, int nPoolSize=40 ); |
| 62 | void addPort( const String &sAddr, int nPort, int nPoolSize=40 ); | 68 | void addPort( const String &sAddr, int nPort, int nPoolSize=40 ); |
| 63 | 69 | ||
| 64 | //void scan(); | 70 | //void scan(); |
| 65 | void setTimeout( int nTimeoutSec, int nTimeoutUSec=0 ); | 71 | void setTimeout( int nTimeoutSec, int nTimeoutUSec=0 ); |
| 66 | 72 | ||
| 67 | void addClient( int nSocket, int nPort ); | 73 | void addClient( socket_t nSocket, int nPort ); |
| 68 | 74 | ||
| 69 | virtual void onNewConnection( Client *pClient, int nPort )=0; | 75 | virtual void onNewConnection( Client *pClient, int nPort )=0; |
| 70 | virtual void onClosedConnection( Client *pClient )=0; | 76 | virtual void onClosedConnection( Client *pClient )=0; |
| @@ -78,7 +84,7 @@ namespace Bu | |||
| 78 | { | 84 | { |
| 79 | friend class Bu::ItoServer::SrvClientLink; | 85 | friend class Bu::ItoServer::SrvClientLink; |
| 80 | public: | 86 | public: |
| 81 | ItoClient( ItoServer &rSrv, int nSocket, int nPort, | 87 | ItoClient( ItoServer &rSrv, socket_t nSocket, int nPort, |
| 82 | int nTimeoutSec, int nTimeoutUSec ); | 88 | int nTimeoutSec, int nTimeoutUSec ); |
| 83 | virtual ~ItoClient(); | 89 | virtual ~ItoClient(); |
| 84 | 90 | ||
| @@ -92,7 +98,7 @@ namespace Bu | |||
| 92 | ItoServer &rSrv; | 98 | ItoServer &rSrv; |
| 93 | Client *pClient; | 99 | Client *pClient; |
| 94 | fd_set fdActive; | 100 | fd_set fdActive; |
| 95 | int iSocket; | 101 | socket_t iSocket; |
| 96 | int iPort; | 102 | int iPort; |
| 97 | int nTimeoutSec; | 103 | int nTimeoutSec; |
| 98 | int nTimeoutUSec; | 104 | int nTimeoutUSec; |
| @@ -126,15 +132,15 @@ namespace Bu | |||
| 126 | int nTimeoutSec; | 132 | int nTimeoutSec; |
| 127 | int nTimeoutUSec; | 133 | int nTimeoutUSec; |
| 128 | fd_set fdActive; | 134 | fd_set fdActive; |
| 129 | typedef Hash<int,TcpServerSocket *> ServerHash; | 135 | typedef Hash<socket_t,TcpServerSocket *> ServerHash; |
| 130 | ServerHash hServers; | 136 | ServerHash hServers; |
| 131 | typedef Hash<int,ItoClient *> ClientHash; | 137 | typedef Hash<socket_t,ItoClient *> ClientHash; |
| 132 | typedef SynchroQueue<ItoClient *> ClientQueue; | 138 | typedef SynchroQueue<ItoClient *> ClientQueue; |
| 133 | ClientHash hClients; | 139 | ClientHash hClients; |
| 134 | ClientQueue qClientCleanup; | 140 | ClientQueue qClientCleanup; |
| 135 | Mutex imClients; | 141 | Mutex imClients; |
| 136 | 142 | ||
| 137 | void clientCleanup( int iSocket ); | 143 | void clientCleanup( socket_t iSocket ); |
| 138 | }; | 144 | }; |
| 139 | } | 145 | } |
| 140 | 146 | ||
