summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2010-11-15 22:09:20 (GMT)
committerRemko Tronçon <git@el-tramo.be>2010-11-16 07:16:37 (GMT)
commit999f19158672bd6c91fa274a9f8e968b84f8a931 (patch)
treecbcf864514c0abc71414d187f6810619bbf0fea9 /Swiften/Examples/ConnectivityTest
parent0f4fad3929097dca24d1ca92b06283811661e1f4 (diff)
downloadswift-contrib-999f19158672bd6c91fa274a9f8e968b84f8a931.zip
swift-contrib-999f19158672bd6c91fa274a9f8e968b84f8a931.tar.bz2
Pass NetworkFactories as an explicit dependency into client.
Diffstat (limited to 'Swiften/Examples/ConnectivityTest')
-rw-r--r--Swiften/Examples/ConnectivityTest/ConnectivityTest.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/Swiften/Examples/ConnectivityTest/ConnectivityTest.cpp b/Swiften/Examples/ConnectivityTest/ConnectivityTest.cpp
index 9da5cdf..c090153 100644
--- a/Swiften/Examples/ConnectivityTest/ConnectivityTest.cpp
+++ b/Swiften/Examples/ConnectivityTest/ConnectivityTest.cpp
@@ -8,12 +8,12 @@
#include <boost/thread.hpp>
#include "Swiften/Client/Client.h"
-#include "Swiften/Network/BoostTimer.h"
+#include "Swiften/Network/Timer.h"
+#include "Swiften/Network/TimerFactory.h"
+#include "Swiften/Network/BoostNetworkFactories.h"
#include "Swiften/EventLoop/EventLoop.h"
#include "Swiften/Client/ClientXMLTracer.h"
#include "Swiften/EventLoop/SimpleEventLoop.h"
-#include "Swiften/Network/BoostIOServiceThread.h"
-#include "Swiften/Network/MainBoostIOServiceThread.h"
#include "Swiften/Disco/GetDiscoInfoRequest.h"
using namespace Swift;
@@ -21,6 +21,7 @@ using namespace Swift;
enum ExitCodes {OK = 0, CANNOT_CONNECT, CANNOT_AUTH, NO_RESPONSE, DISCO_ERROR};
SimpleEventLoop eventLoop;
+BoostNetworkFactories networkFactories(&eventLoop);
Client* client = 0;
JID recipient;
@@ -67,7 +68,7 @@ int main(int argc, char* argv[]) {
connectHost = argv[argi++];
}
- client = new Swift::Client(&eventLoop, JID(jid), String(argv[argi++]));
+ client = new Swift::Client(&eventLoop, &networkFactories, JID(jid), String(argv[argi++]));
char* timeoutChar = argv[argi++];
int timeout = atoi(timeoutChar);
timeout = (timeout ? timeout : 30) * 1000;
@@ -84,7 +85,7 @@ int main(int argc, char* argv[]) {
}
{
- BoostTimer::ref timer(BoostTimer::create(timeout, &MainBoostIOServiceThread::getInstance().getIOService(), &eventLoop));
+ Timer::ref timer = networkFactories.getTimerFactory()->createTimer(timeout);
timer->onTick.connect(boost::bind(&SimpleEventLoop::stop, &eventLoop));
timer->start();