summaryrefslogtreecommitdiffstats
blob: b10ba1a2ea453d5a01875c11bf05238e5804d1d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include "Swiften/StreamStack/WhitespacePingLayer.h"
#include "Swiften/Network/Timer.h"

namespace Swift {

static const int TIMEOUT_MILLISECONDS = 60000;

WhitespacePingLayer::WhitespacePingLayer() {
	timer = boost::shared_ptr<Timer>(new Timer(TIMEOUT_MILLISECONDS));
	timer->onTick.connect(boost::bind(&WhitespacePingLayer::handleTimerTick, this));
	timer->start();
}

void WhitespacePingLayer::writeData(const ByteArray& data) {
	onWriteData(data);
}

void WhitespacePingLayer::handleDataRead(const ByteArray& data) {
	onDataRead(data);
}

void WhitespacePingLayer::handleTimerTick() {
	onWriteData(" ");
}

}