Skip to content

Commit 3c8b4e4

Browse files
committed
Do not publish the event if the keepalive interval has not changed
1 parent 53a5cd8 commit 3c8b4e4

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
@@ -1130,6 +1130,9 @@ bool publishKeepaliveInterval(unsigned interval) {
11301130
return false;
11311131
}
11321132
}
1133+
// TODO: Even though the keepalive interval is not supposed to be changed frequently, it would be
1134+
// nice to make sure the previously published event is either sent or cancelled before publishing
1135+
// a new event. This would help to mitigate the effect of possible out of order delivery
11331136
char buf[16] = {};
11341137
snprintf(buf, sizeof(buf), "%u", interval);
11351138
return publishEvent(KEEPALIVE_INTERVAL_EVENT, buf);

0 commit comments

Comments
 (0)