diff options
| author | Mike Buland <eichlan@xagasoft.com> | 2008-03-20 03:21:59 +0000 |
|---|---|---|
| committer | Mike Buland <eichlan@xagasoft.com> | 2008-03-20 03:21:59 +0000 |
| commit | 68f4dfa0e2996211a9439809df07e36614618a63 (patch) | |
| tree | 7e86ff3cdb8863629c77aa50b6b922678ce2cb4c /src/multiserver.cpp | |
| parent | 6c27b9b4024331558e6a719293f2b44a6ae77c28 (diff) | |
| download | libbu++-68f4dfa0e2996211a9439809df07e36614618a63.tar.gz libbu++-68f4dfa0e2996211a9439809df07e36614618a63.tar.bz2 libbu++-68f4dfa0e2996211a9439809df07e36614618a63.tar.xz libbu++-68f4dfa0e2996211a9439809df07e36614618a63.zip | |
This is a preliminary test of my new server simplification subclass, don't use
it yet, the name will change. I really, really, really want the name to change.
Diffstat (limited to 'src/multiserver.cpp')
| -rw-r--r-- | src/multiserver.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/multiserver.cpp b/src/multiserver.cpp new file mode 100644 index 0000000..56284b0 --- /dev/null +++ b/src/multiserver.cpp | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | #include "bu/multiserver.h" | ||
| 2 | #include "bu/protocol.h" | ||
| 3 | #include "bu/client.h" | ||
| 4 | |||
| 5 | Bu::MultiServer::MultiServer() | ||
| 6 | { | ||
| 7 | } | ||
| 8 | |||
| 9 | Bu::MultiServer::~MultiServer() | ||
| 10 | { | ||
| 11 | } | ||
| 12 | |||
| 13 | void Bu::MultiServer::addProtocol( Bu::Protocol *(*proc)(), int iPort, | ||
| 14 | int nPoolSize ) | ||
| 15 | { | ||
| 16 | hProtos[iPort] = proc; | ||
| 17 | addPort( iPort, nPoolSize ); | ||
| 18 | } | ||
| 19 | |||
| 20 | void Bu::MultiServer::addProtocol( Protocol *(*proc)(), const FString &sAddr, | ||
| 21 | int iPort, int nPoolSize ) | ||
| 22 | { | ||
| 23 | hProtos[iPort] = proc; | ||
| 24 | addPort( sAddr, iPort, nPoolSize ); | ||
| 25 | } | ||
| 26 | |||
| 27 | void Bu::MultiServer::onNewConnection( Bu::Client *pClient, int nPort ) | ||
| 28 | { | ||
| 29 | pClient->setProtocol( hProtos.get( nPort )() ); | ||
| 30 | } | ||
| 31 | |||
| 32 | void Bu::MultiServer::onClosedConnection( Bu::Client *pClient ) | ||
| 33 | { | ||
| 34 | delete pClient->getProtocol(); | ||
| 35 | } | ||
| 36 | |||
