aboutsummaryrefslogtreecommitdiff
path: root/src/multiserver.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/multiserver.cpp36
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
5Bu::MultiServer::MultiServer()
6{
7}
8
9Bu::MultiServer::~MultiServer()
10{
11}
12
13void Bu::MultiServer::addProtocol( Bu::Protocol *(*proc)(), int iPort,
14 int nPoolSize )
15{
16 hProtos[iPort] = proc;
17 addPort( iPort, nPoolSize );
18}
19
20void 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
27void Bu::MultiServer::onNewConnection( Bu::Client *pClient, int nPort )
28{
29 pClient->setProtocol( hProtos.get( nPort )() );
30}
31
32void Bu::MultiServer::onClosedConnection( Bu::Client *pClient )
33{
34 delete pClient->getProtocol();
35}
36