summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2010-10-27 19:06:56 (GMT)
committerRemko Tronçon <git@el-tramo.be>2010-10-27 19:07:55 (GMT)
commit6810a2896f27e7ee07aee847f5e8dbccd1f6ec89 (patch)
treef7ea87f030e57cb4494a4f897506fb18fc3d2241 /Slimber/Server.cpp
parenta7da393cfc807048d320ddba8a1c7d24ef23a46e (diff)
downloadswift-6810a2896f27e7ee07aee847f5e8dbccd1f6ec89.zip
swift-6810a2896f27e7ee07aee847f5e8dbccd1f6ec89.tar.bz2
Remove MainEventLoop singleton.
The event loop now needs to be explicitly passed to clients using it.
Diffstat (limited to 'Slimber/Server.cpp')
-rw-r--r--Slimber/Server.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/Slimber/Server.cpp b/Slimber/Server.cpp
index 734f3b8..c6e700e 100644
--- a/Slimber/Server.cpp
+++ b/Slimber/Server.cpp
@@ -37,13 +37,15 @@ Server::Server(
int clientConnectionPort,
int linkLocalConnectionPort,
LinkLocalServiceBrowser* linkLocalServiceBrowser,
- VCardCollection* vCardCollection) :
+ VCardCollection* vCardCollection,
+ EventLoop* eventLoop) :
linkLocalServiceRegistered(false),
rosterRequested(false),
clientConnectionPort(clientConnectionPort),
linkLocalConnectionPort(linkLocalConnectionPort),
linkLocalServiceBrowser(linkLocalServiceBrowser),
vCardCollection(vCardCollection),
+ eventLoop(eventLoop),
presenceManager(NULL),
stopping(false) {
linkLocalServiceBrowser->onServiceRegistered.connect(
@@ -57,7 +59,7 @@ Server::~Server() {
void Server::start() {
assert(!serverFromClientConnectionServer);
serverFromClientConnectionServer = BoostConnectionServer::create(
- clientConnectionPort, &boostIOServiceThread.getIOService());
+ clientConnectionPort, &boostIOServiceThread.getIOService(), eventLoop);
serverFromClientConnectionServerSignalConnections.push_back(
serverFromClientConnectionServer->onNewConnection.connect(
boost::bind(&Server::handleNewClientConnection, this, _1)));
@@ -67,7 +69,7 @@ void Server::start() {
assert(!serverFromNetworkConnectionServer);
serverFromNetworkConnectionServer = BoostConnectionServer::create(
- linkLocalConnectionPort, &boostIOServiceThread.getIOService());
+ linkLocalConnectionPort, &boostIOServiceThread.getIOService(), eventLoop);
serverFromNetworkConnectionServerSignalConnections.push_back(
serverFromNetworkConnectionServer->onNewConnection.connect(
boost::bind(&Server::handleNewLinkLocalConnection, this, _1)));
@@ -254,7 +256,7 @@ void Server::handleElementReceived(boost::shared_ptr<Element> element, boost::sh
new LinkLocalConnector(
*service,
linkLocalServiceBrowser->getQuerier(),
- BoostConnection::create(&boostIOServiceThread.getIOService())));
+ BoostConnection::create(&boostIOServiceThread.getIOService(), eventLoop)));
connector->onConnectFinished.connect(
boost::bind(&Server::handleConnectFinished, this, connector, _1));
connectors.push_back(connector);