diff options
Diffstat (limited to '')
-rw-r--r-- | src/stable/multiserver.h | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/src/stable/multiserver.h b/src/stable/multiserver.h index b2f633a..8a49bbd 100644 --- a/src/stable/multiserver.h +++ b/src/stable/multiserver.h | |||
@@ -13,45 +13,45 @@ | |||
13 | 13 | ||
14 | namespace Bu | 14 | namespace Bu |
15 | { | 15 | { |
16 | class Protocol; | 16 | class Protocol; |
17 | class Client; | 17 | class Client; |
18 | 18 | ||
19 | template<class T> | 19 | template<class T> |
20 | Protocol *genProtocol() | 20 | Protocol *genProtocol() |
21 | { | 21 | { |
22 | return new T; | 22 | return new T; |
23 | } | 23 | } |
24 | 24 | ||
25 | class MultiServer : protected Server | 25 | class MultiServer : protected Server |
26 | { | 26 | { |
27 | public: | 27 | public: |
28 | MultiServer(); | 28 | MultiServer(); |
29 | virtual ~MultiServer(); | 29 | virtual ~MultiServer(); |
30 | 30 | ||
31 | void addProtocol( Protocol *(*proc)(), int iPort, int nPoolSize=40 ); | 31 | void addProtocol( Protocol *(*proc)(), int iPort, int nPoolSize=40 ); |
32 | void addProtocol( Protocol *(*proc)(), const String &sAddr, int iPort, | 32 | void addProtocol( Protocol *(*proc)(), const String &sAddr, int iPort, |
33 | int nPoolSize=40 ); | 33 | int nPoolSize=40 ); |
34 | 34 | ||
35 | void scan() | 35 | void scan() |
36 | { | 36 | { |
37 | Server::scan(); | 37 | Server::scan(); |
38 | } | 38 | } |
39 | 39 | ||
40 | void setTimeout( int nTimeoutSec, int nTimeoutUSec=0 ) | 40 | void setTimeout( int nTimeoutSec, int nTimeoutUSec=0 ) |
41 | { | 41 | { |
42 | Server::setTimeout( nTimeoutSec, nTimeoutUSec ); | 42 | Server::setTimeout( nTimeoutSec, nTimeoutUSec ); |
43 | } | 43 | } |
44 | 44 | ||
45 | virtual void onNewConnection( Client *pClient, int nPort ); | 45 | virtual void onNewConnection( Client *pClient, int nPort ); |
46 | virtual void onClosedConnection( Client *pClient ); | 46 | virtual void onClosedConnection( Client *pClient ); |
47 | 47 | ||
48 | void shutdown(); | 48 | void shutdown(); |
49 | 49 | ||
50 | void tick(); | 50 | void tick(); |
51 | 51 | ||
52 | private: | 52 | private: |
53 | Bu::Hash<int, Protocol *(*)()> hProtos; | 53 | Bu::Hash<int, Protocol *(*)()> hProtos; |
54 | }; | 54 | }; |
55 | } | 55 | } |
56 | 56 | ||
57 | #endif | 57 | #endif |