From 469bbcf0701e1eb8a6670c23145b0da87357e178 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Sun, 25 Mar 2012 20:00:08 +0000 Subject: Code is all reorganized. We're about ready to release. I should write up a little explenation of the arrangement. --- src/stable/multiserver.cpp | 55 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 src/stable/multiserver.cpp (limited to 'src/stable/multiserver.cpp') 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 @@ +/* + * Copyright (C) 2007-2011 Xagasoft, All rights reserved. + * + * This file is part of the libbu++ library and is released under the + * terms of the license contained in the file LICENSE. + */ + +#include "bu/multiserver.h" +#include "bu/protocol.h" +#include "bu/client.h" + +#include "bu/config.h" + +Bu::MultiServer::MultiServer() +{ +} + +Bu::MultiServer::~MultiServer() +{ +} + +void Bu::MultiServer::addProtocol( Bu::Protocol *(*proc)(), int iPort, + int nPoolSize ) +{ + hProtos[iPort] = proc; + addPort( iPort, nPoolSize ); +} + +void Bu::MultiServer::addProtocol( Protocol *(*proc)(), const String &sAddr, + int iPort, int nPoolSize ) +{ + hProtos[iPort] = proc; + addPort( sAddr, iPort, nPoolSize ); +} + +void Bu::MultiServer::onNewConnection( Bu::Client *pClient, int nPort ) +{ + pClient->setProtocol( hProtos.get( nPort )() ); +} + +void Bu::MultiServer::onClosedConnection( Bu::Client *pClient ) +{ + delete pClient->getProtocol(); +} + +void Bu::MultiServer::shutdown() +{ + Bu::Server::shutdown(); +} + +void Bu::MultiServer::tick() +{ + Bu::Server::tick(); +} + -- cgit v1.2.3