summaryrefslogtreecommitdiff
path: root/src/multiserver.h
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2012-03-25 20:00:08 +0000
committerMike Buland <eichlan@xagasoft.com>2012-03-25 20:00:08 +0000
commit469bbcf0701e1eb8a6670c23145b0da87357e178 (patch)
treeb5b062a16e46a6c5d3410b4e574cd0cc09057211 /src/multiserver.h
parentee1b79396076edc4e30aefb285fada03bb45e80d (diff)
downloadlibbu++-469bbcf0701e1eb8a6670c23145b0da87357e178.tar.gz
libbu++-469bbcf0701e1eb8a6670c23145b0da87357e178.tar.bz2
libbu++-469bbcf0701e1eb8a6670c23145b0da87357e178.tar.xz
libbu++-469bbcf0701e1eb8a6670c23145b0da87357e178.zip
Code is all reorganized. We're about ready to release. I should write up a
little explenation of the arrangement.
Diffstat (limited to 'src/multiserver.h')
-rw-r--r--src/multiserver.h57
1 files changed, 0 insertions, 57 deletions
diff --git a/src/multiserver.h b/src/multiserver.h
deleted file mode 100644
index e3b3ec3..0000000
--- a/src/multiserver.h
+++ /dev/null
@@ -1,57 +0,0 @@
1/*
2 * Copyright (C) 2007-2011 Xagasoft, All rights reserved.
3 *
4 * This file is part of the libbu++ library and is released under the
5 * terms of the license contained in the file LICENSE.
6 */
7
8#ifndef BU_MULTI_SERVER_H
9#define BU_MULTI_SERVER_H
10
11#include "bu/server.h"
12#include "bu/hash.h"
13
14namespace Bu
15{
16 class Protocol;
17 class Client;
18
19 template<class T>
20 Protocol *genProtocol()
21 {
22 return new T;
23 }
24
25 class MultiServer : protected Server
26 {
27 public:
28 MultiServer();
29 virtual ~MultiServer();
30
31 void addProtocol( Protocol *(*proc)(), int iPort, int nPoolSize=40 );
32 void addProtocol( Protocol *(*proc)(), const String &sAddr, int iPort,
33 int nPoolSize=40 );
34
35 void scan()
36 {
37 Server::scan();
38 }
39
40 void setTimeout( int nTimeoutSec, int nTimeoutUSec=0 )
41 {
42 Server::setTimeout( nTimeoutSec, nTimeoutUSec );
43 }
44
45 virtual void onNewConnection( Client *pClient, int nPort );
46 virtual void onClosedConnection( Client *pClient );
47
48 void shutdown();
49
50 void tick();
51
52 private:
53 Bu::Hash<int, Protocol *(*)()> hProtos;
54 };
55}
56
57#endif