Invoke ping callback only if a new ping value has been added.

This commit is contained in:
lotodore
2014-01-08 22:27:10 +01:00
parent 8db313d555
commit 0f23bf0105
2 changed files with 7 additions and 3 deletions
+4 -1
View File
@@ -77,14 +77,17 @@ public:
void StartPing() {
pingTimer.start();
}
void EndPing() {
bool EndPing() {
bool retVal = false;
if (pingTimer.is_running()) {
pingValues.push_back((unsigned)pingTimer.elapsed().total_milliseconds());
if (pingValues.size() > SIZE_PING_BACKLOG) {
pingValues.pop_front();
}
pingTimer.reset();
retVal = true;
}
return retVal;
}
private: