Skip to content

Commit 8aa842c

Browse files
rlubosdanieldegrasse
authored andcommitted
net: lwm2m: Prevent busy looping when active notify is set
In case a new notification is triggered while the previous one is still active (i.e. not acknowledged), the LwM2M engine will start busy looping, as the new notification is still valid (and supposed to be sent after the previous one is done), but it's not sent in the current iteration. The busy looping might prevent the system from receiving the acknowledgment for the previous one, resulting in unresponsive system. Fix this, by delaying the new notification timestamp a bit in such case, so that the new notification will be scheduled for later instead of trying to send it again right away. Signed-off-by: Robert Lubos <[email protected]>
1 parent a9c30d7 commit 8aa842c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

subsys/net/lib/lwm2m/lwm2m_engine.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME);
7171
#endif
7272

7373
#define ENGINE_SLEEP_MS 500
74+
#define NOTIFY_DELAY_MS 100
7475

7576
#ifdef CONFIG_LWM2M_VERSION_1_1
7677
#define LWM2M_ENGINE_MAX_OBSERVER_PATH CONFIG_LWM2M_ENGINE_MAX_OBSERVER * 3
@@ -613,6 +614,7 @@ static int64_t check_notifications(struct lwm2m_ctx *ctx, const int64_t timestam
613614
}
614615
/* Check That There is not pending process*/
615616
if (obs->active_notify != NULL) {
617+
obs->event_timestamp += NOTIFY_DELAY_MS;
616618
continue;
617619
}
618620

0 commit comments

Comments
 (0)