diff options
Diffstat (limited to 'Swiften/StreamStack')
-rw-r--r-- | Swiften/StreamStack/WhitespacePingLayer.cpp | 10 | ||||
-rw-r--r-- | Swiften/StreamStack/WhitespacePingLayer.h | 3 |
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(); |