Skip to content
Browse files

Bluetooth: Mesh: Fix postponing storage deadline indefinitely

If the local node keeps getting bombarded with messages, it's possible
that the storage timer gets rescheduled over and over again and never
expires. Add the necessary code to only reschedule the timer if the
new deadline is earlier than an existing one.

Signed-off-by: Johan Hedberg <>
  • Loading branch information...
jhedberg committed May 7, 2019
1 parent c0a7e4d commit e9ed634654266a0c66c4e1caaaf42a8d5db98df6
Showing with 7 additions and 1 deletion.
  1. +7 −1 subsys/bluetooth/host/mesh/settings.c
@@ -821,7 +821,7 @@ BT_SETTINGS_DEFINE(mesh, mesh_set, mesh_commit, NULL);

static void schedule_store(int flag)
s32_t timeout;
s32_t timeout, remaining;

atomic_set_bit(bt_mesh.flags, flag);

@@ -836,6 +836,12 @@ static void schedule_store(int flag)

remaining = k_delayed_work_remaining_get(&pending_store);
if (remaining && remaining < timeout) {
BT_DBG("Not rescheduling due to existing earlier deadline");

BT_DBG("Waiting %d seconds", timeout / MSEC_PER_SEC);

k_delayed_work_submit(&pending_store, timeout);

0 comments on commit e9ed634

Please sign in to comment.
You can’t perform that action at this time.