ble_mesh: fix postponing storage deadline indefinitely

This commit is contained in:
lly 2019-09-02 14:17:47 +08:00
parent c44a3f1209
commit 9c98a8d645

View File

@ -846,7 +846,7 @@ int settings_core_commit(void)
static void schedule_store(int flag)
{
s32_t timeout;
s32_t timeout, remaining;
bt_mesh_atomic_set_bit(bt_mesh.flags, flag);
@ -861,6 +861,12 @@ static void schedule_store(int flag)
timeout = K_SECONDS(CONFIG_BLE_MESH_STORE_TIMEOUT);
}
remaining = k_delayed_work_remaining_get(&pending_store);
if (remaining && remaining < timeout) {
BT_DBG("Not rescheduling due to existing earlier deadline");
return;
}
BT_DBG("Waiting %d seconds", timeout / MSEC_PER_SEC);
if (timeout) {