From eedaf45f43810d87c05678100a8f034262ef4549 Mon Sep 17 00:00:00 2001 From: lly Date: Sat, 28 Mar 2020 16:03:46 +0800 Subject: [PATCH] ble_mesh: Continue node info restore even if failure happens During BLE Mesh Provisioner initialization, the stack will restore the nodes information if settings storage is enabled. Previously when a failure happens (e.g. found the same uuid) during the restore procedure, the information of the following nodes will not be restored and error will be directly returned. But this will introduce some problem with user experience, because some newly provisioned nodes information will not be restored and Provisioner will not be able to control those nodes. So we change the operation here, when a failure happens during the restore procedure, Provisioner will only ignore the information of the current node and continue restoring other nodes information. --- components/bt/esp_ble_mesh/mesh_core/settings.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/components/bt/esp_ble_mesh/mesh_core/settings.c b/components/bt/esp_ble_mesh/mesh_core/settings.c index 466e92b5d..3e62f9fb1 100644 --- a/components/bt/esp_ble_mesh/mesh_core/settings.c +++ b/components/bt/esp_ble_mesh/mesh_core/settings.c @@ -1150,13 +1150,13 @@ static int p_node_set(const char *name) u16_t addr = net_buf_simple_pull_le16(buf); if (!BLE_MESH_ADDR_IS_UNICAST(addr)) { BT_ERR("%s, 0x%04x is not a unicast address", __func__, addr); - goto free; + continue; } err = node_info_set(addr, &exist); if (err) { BT_ERR("%s, Failed to load node 0x%04x info", __func__, addr); - goto free; + continue; } if (exist == false) { @@ -1166,17 +1166,16 @@ static int p_node_set(const char *name) err = node_name_set(addr); if (err) { BT_ERR("%s, Failed to load node 0x%04x name", __func__, addr); - goto free; + continue; } err = node_comp_data_set(addr); if (err) { BT_ERR("%s, Failed to load node 0x%04x comp data", __func__, addr); - goto free; + continue; } } -free: bt_mesh_free_buf(buf); return err; }