summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2009-11-12 19:48:32 (GMT)
committerRemko Tronçon <git@el-tramo.be>2009-11-12 20:41:59 (GMT)
commit8231ecc07c1c7d5e260a2795b0660de157501850 (patch)
tree935baa855914d632086fcac5f26330c2f0261216 /Swiften/StreamStack
parent48bb7441f913144d6a20687ff79264e4631156f0 (diff)
downloadswift-contrib-8231ecc07c1c7d5e260a2795b0660de157501850.zip
swift-contrib-8231ecc07c1c7d5e260a2795b0660de157501850.tar.bz2
Created a TimerFactory, and abstracted Timer.
Diffstat (limited to 'Swiften/StreamStack')
-rw-r--r--Swiften/StreamStack/WhitespacePingLayer.cpp10
-rw-r--r--Swiften/StreamStack/WhitespacePingLayer.h3
2 files changed, 7 insertions, 6 deletions
diff --git a/Swiften/StreamStack/WhitespacePingLayer.cpp b/Swiften/StreamStack/WhitespacePingLayer.cpp
index 939c4fa..5c1eb00 100644
--- a/Swiften/StreamStack/WhitespacePingLayer.cpp
+++ b/Swiften/StreamStack/WhitespacePingLayer.cpp
@@ -1,16 +1,16 @@
#include "Swiften/StreamStack/WhitespacePingLayer.h"
-#include "Swiften/Network/BoostIOServiceThread.h"
-#include "Swiften/Network/MainBoostIOServiceThread.h"
+#include <boost/bind.hpp>
+
+#include "Swiften/Network/TimerFactory.h"
#include "Swiften/Network/Timer.h"
namespace Swift {
static const int TIMEOUT_MILLISECONDS = 60000;
-WhitespacePingLayer::WhitespacePingLayer() : isActive(false) {
- // FIXME: Create a BoostTimerFactory.
- timer = boost::shared_ptr<Timer>(new Timer(TIMEOUT_MILLISECONDS, &MainBoostIOServiceThread::getInstance().getIOService()));
+WhitespacePingLayer::WhitespacePingLayer(TimerFactory* timerFactory) : isActive(false) {
+ timer = timerFactory->createTimer(TIMEOUT_MILLISECONDS);
timer->onTick.connect(boost::bind(&WhitespacePingLayer::handleTimerTick, this));
}
diff --git a/Swiften/StreamStack/WhitespacePingLayer.h b/Swiften/StreamStack/WhitespacePingLayer.h
index 9d6957b..18ea39a 100644
--- a/Swiften/StreamStack/WhitespacePingLayer.h
+++ b/Swiften/StreamStack/WhitespacePingLayer.h
@@ -7,10 +7,11 @@
namespace Swift {
class Timer;
+ class TimerFactory;
class WhitespacePingLayer : public StreamLayer, boost::noncopyable {
public:
- WhitespacePingLayer();
+ WhitespacePingLayer(TimerFactory* timerFactory);
void setActive();
void setInactive();