summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften')
-rw-r--r--Swiften/StreamStack/WhitespacePingLayer.cpp4
-rw-r--r--Swiften/StreamStack/WhitespacePingLayer.h5
2 files changed, 8 insertions, 1 deletions
diff --git a/Swiften/StreamStack/WhitespacePingLayer.cpp b/Swiften/StreamStack/WhitespacePingLayer.cpp
index 25e4436..939c4fa 100644
--- a/Swiften/StreamStack/WhitespacePingLayer.cpp
+++ b/Swiften/StreamStack/WhitespacePingLayer.cpp
@@ -8,7 +8,7 @@ namespace Swift {
static const int TIMEOUT_MILLISECONDS = 60000;
-WhitespacePingLayer::WhitespacePingLayer() {
+WhitespacePingLayer::WhitespacePingLayer() : isActive(false) {
// FIXME: Create a BoostTimerFactory.
timer = boost::shared_ptr<Timer>(new Timer(TIMEOUT_MILLISECONDS, &MainBoostIOServiceThread::getInstance().getIOService()));
timer->onTick.connect(boost::bind(&WhitespacePingLayer::handleTimerTick, this));
@@ -27,11 +27,13 @@ void WhitespacePingLayer::handleTimerTick() {
}
void WhitespacePingLayer::setActive() {
+ isActive = true;
timer->start();
}
void WhitespacePingLayer::setInactive() {
timer->stop();
+ isActive = false;
}
}
diff --git a/Swiften/StreamStack/WhitespacePingLayer.h b/Swiften/StreamStack/WhitespacePingLayer.h
index de6013b..9d6957b 100644
--- a/Swiften/StreamStack/WhitespacePingLayer.h
+++ b/Swiften/StreamStack/WhitespacePingLayer.h
@@ -17,10 +17,15 @@ namespace Swift {
void writeData(const ByteArray& data);
void handleDataRead(const ByteArray& data);
+ bool getIsActive() const {
+ return isActive;
+ }
+
private:
void handleTimerTick();
private:
+ bool isActive;
boost::shared_ptr<Timer> timer;
};
}