diff options
| author | Mike Buland <eichlan@xagasoft.com> | 2012-03-25 20:00:08 +0000 |
|---|---|---|
| committer | Mike Buland <eichlan@xagasoft.com> | 2012-03-25 20:00:08 +0000 |
| commit | 469bbcf0701e1eb8a6670c23145b0da87357e178 (patch) | |
| tree | b5b062a16e46a6c5d3410b4e574cd0cc09057211 /src/stable/multiserver.cpp | |
| parent | ee1b79396076edc4e30aefb285fada03bb45e80d (diff) | |
| download | libbu++-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/stable/multiserver.cpp')
| -rw-r--r-- | src/stable/multiserver.cpp | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/stable/multiserver.cpp b/src/stable/multiserver.cpp new file mode 100644 index 0000000..bd598ed --- /dev/null +++ b/src/stable/multiserver.cpp | |||
| @@ -0,0 +1,55 @@ | |||
| 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 | #include "bu/multiserver.h" | ||
| 9 | #include "bu/protocol.h" | ||
| 10 | #include "bu/client.h" | ||
| 11 | |||
| 12 | #include "bu/config.h" | ||
| 13 | |||
| 14 | Bu::MultiServer::MultiServer() | ||
| 15 | { | ||
| 16 | } | ||
| 17 | |||
| 18 | Bu::MultiServer::~MultiServer() | ||
| 19 | { | ||
| 20 | } | ||
| 21 | |||
| 22 | void Bu::MultiServer::addProtocol( Bu::Protocol *(*proc)(), int iPort, | ||
| 23 | int nPoolSize ) | ||
| 24 | { | ||
| 25 | hProtos[iPort] = proc; | ||
| 26 | addPort( iPort, nPoolSize ); | ||
| 27 | } | ||
| 28 | |||
| 29 | void Bu::MultiServer::addProtocol( Protocol *(*proc)(), const String &sAddr, | ||
| 30 | int iPort, int nPoolSize ) | ||
| 31 | { | ||
| 32 | hProtos[iPort] = proc; | ||
| 33 | addPort( sAddr, iPort, nPoolSize ); | ||
| 34 | } | ||
| 35 | |||
| 36 | void Bu::MultiServer::onNewConnection( Bu::Client *pClient, int nPort ) | ||
| 37 | { | ||
| 38 | pClient->setProtocol( hProtos.get( nPort )() ); | ||
| 39 | } | ||
| 40 | |||
| 41 | void Bu::MultiServer::onClosedConnection( Bu::Client *pClient ) | ||
| 42 | { | ||
| 43 | delete pClient->getProtocol(); | ||
| 44 | } | ||
| 45 | |||
| 46 | void Bu::MultiServer::shutdown() | ||
| 47 | { | ||
| 48 | Bu::Server::shutdown(); | ||
| 49 | } | ||
| 50 | |||
| 51 | void Bu::MultiServer::tick() | ||
| 52 | { | ||
| 53 | Bu::Server::tick(); | ||
| 54 | } | ||
| 55 | |||
