summaryrefslogtreecommitdiff
path: root/src/stable/multiserver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/stable/multiserver.cpp')
-rw-r--r--src/stable/multiserver.cpp55
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
14Bu::MultiServer::MultiServer()
15{
16}
17
18Bu::MultiServer::~MultiServer()
19{
20}
21
22void Bu::MultiServer::addProtocol( Bu::Protocol *(*proc)(), int iPort,
23 int nPoolSize )
24{
25 hProtos[iPort] = proc;
26 addPort( iPort, nPoolSize );
27}
28
29void 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
36void Bu::MultiServer::onNewConnection( Bu::Client *pClient, int nPort )
37{
38 pClient->setProtocol( hProtos.get( nPort )() );
39}
40
41void Bu::MultiServer::onClosedConnection( Bu::Client *pClient )
42{
43 delete pClient->getProtocol();
44}
45
46void Bu::MultiServer::shutdown()
47{
48 Bu::Server::shutdown();
49}
50
51void Bu::MultiServer::tick()
52{
53 Bu::Server::tick();
54}
55