Skip to content

Commit ac0c73f

Browse files
committed
Do not publish the event if the keepalive interval has not changed
1 parent 1ca9e79 commit ac0c73f

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

communication/src/ping.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,11 @@ class Pinger
4545
// TODO: It feels that this logic should have been implemented in the system layer
4646
if ( !(this->keepalive_source == KeepAliveSource::USER && source == KeepAliveSource::SYSTEM) )
4747
{
48-
this->ping_interval = interval;
4948
this->keepalive_source = source;
50-
return true;
49+
if (this->ping_interval != interval) {
50+
this->ping_interval = interval;
51+
return true;
52+
}
5153
}
5254
return false;
5355
}

system/src/system_cloud_internal.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,6 +1109,9 @@ bool publishKeepaliveInterval(unsigned interval) {
11091109
return false;
11101110
}
11111111
}
1112+
// TODO: Even though the keepalive interval is not supposed to be changed frequently, it would be
1113+
// nice to make sure the previously published event is either sent or cancelled before publishing
1114+
// a new event. This would help to mitigate the effect of possible out of order delivery
11121115
char buf[16] = {};
11131116
snprintf(buf, sizeof(buf), "%u", interval);
11141117
return publishEvent(KEEPALIVE_INTERVAL_EVENT, buf);

0 commit comments

Comments
 (0)