mirror of
https://github.com/espressif/esp-idf.git
synced 2024-09-20 00:36:01 -04:00
ble_mesh: fix RPL storage timeout handling
This commit is contained in:
parent
9a7efd30ef
commit
c44a3f1209
@ -209,7 +209,7 @@ enum {
|
|||||||
BLE_MESH_IVU_TEST, /* IV Update test mode */
|
BLE_MESH_IVU_TEST, /* IV Update test mode */
|
||||||
BLE_MESH_IVU_PENDING, /* Update blocked by SDU in progress */
|
BLE_MESH_IVU_PENDING, /* Update blocked by SDU in progress */
|
||||||
|
|
||||||
/* pending storage actions */
|
/* pending storage actions, must reside within first 32 flags */
|
||||||
BLE_MESH_RPL_PENDING,
|
BLE_MESH_RPL_PENDING,
|
||||||
BLE_MESH_KEYS_PENDING,
|
BLE_MESH_KEYS_PENDING,
|
||||||
BLE_MESH_NET_PENDING,
|
BLE_MESH_NET_PENDING,
|
||||||
|
@ -833,19 +833,29 @@ int settings_core_commit(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Pending flags that use K_NO_WAIT as the storage timeout */
|
||||||
|
#define NO_WAIT_PENDING_BITS (BIT(BLE_MESH_NET_PENDING) | \
|
||||||
|
BIT(BLE_MESH_IV_PENDING) | \
|
||||||
|
BIT(BLE_MESH_SEQ_PENDING))
|
||||||
|
|
||||||
|
/* Pending flags that use CONFIG_BLE_MESH_STORE_TIMEOUT */
|
||||||
|
#define GENERIC_PENDING_BITS (BIT(BLE_MESH_KEYS_PENDING) | \
|
||||||
|
BIT(BLE_MESH_HB_PUB_PENDING) | \
|
||||||
|
BIT(BLE_MESH_CFG_PENDING) | \
|
||||||
|
BIT(BLE_MESH_MOD_PENDING))
|
||||||
|
|
||||||
static void schedule_store(int flag)
|
static void schedule_store(int flag)
|
||||||
{
|
{
|
||||||
s32_t timeout;
|
s32_t timeout;
|
||||||
|
|
||||||
bt_mesh_atomic_set_bit(bt_mesh.flags, flag);
|
bt_mesh_atomic_set_bit(bt_mesh.flags, flag);
|
||||||
|
|
||||||
if (bt_mesh_atomic_test_bit(bt_mesh.flags, BLE_MESH_NET_PENDING) ||
|
if (bt_mesh_atomic_get(bt_mesh.flags) & NO_WAIT_PENDING_BITS) {
|
||||||
bt_mesh_atomic_test_bit(bt_mesh.flags, BLE_MESH_IV_PENDING) ||
|
|
||||||
bt_mesh_atomic_test_bit(bt_mesh.flags, BLE_MESH_SEQ_PENDING)) {
|
|
||||||
timeout = K_NO_WAIT;
|
timeout = K_NO_WAIT;
|
||||||
} else if (bt_mesh_atomic_test_bit(bt_mesh.flags, BLE_MESH_RPL_PENDING) &&
|
} else if (bt_mesh_atomic_test_bit(bt_mesh.flags, BLE_MESH_RPL_PENDING) &&
|
||||||
(CONFIG_BLE_MESH_RPL_STORE_TIMEOUT <
|
(!(bt_mesh_atomic_get(bt_mesh.flags) & GENERIC_PENDING_BITS) ||
|
||||||
CONFIG_BLE_MESH_STORE_TIMEOUT)) {
|
(CONFIG_BLE_MESH_RPL_STORE_TIMEOUT <
|
||||||
|
CONFIG_BLE_MESH_STORE_TIMEOUT))) {
|
||||||
timeout = K_SECONDS(CONFIG_BLE_MESH_RPL_STORE_TIMEOUT);
|
timeout = K_SECONDS(CONFIG_BLE_MESH_RPL_STORE_TIMEOUT);
|
||||||
} else {
|
} else {
|
||||||
timeout = K_SECONDS(CONFIG_BLE_MESH_STORE_TIMEOUT);
|
timeout = K_SECONDS(CONFIG_BLE_MESH_STORE_TIMEOUT);
|
||||||
|
Loading…
Reference in New Issue
Block a user