From 6ec0c6743af0ea3aa1bb3fbdd121ba9bbacd68c6 Mon Sep 17 00:00:00 2001 From: lly Date: Mon, 2 Sep 2019 14:42:35 +0800 Subject: [PATCH] ble_mesh: fix provisioning send error handling --- components/bt/esp_ble_mesh/mesh_core/prov.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/components/bt/esp_ble_mesh/mesh_core/prov.c b/components/bt/esp_ble_mesh/mesh_core/prov.c index c7c1dae4dc..b270519365 100644 --- a/components/bt/esp_ble_mesh/mesh_core/prov.c +++ b/components/bt/esp_ble_mesh/mesh_core/prov.c @@ -549,7 +549,10 @@ static void prov_send_fail_msg(u8_t err) prov_buf_init(&buf, PROV_FAILED); net_buf_simple_add_u8(&buf, err); - prov_send(&buf); + + if (prov_send(&buf)) { + BT_ERR("Failed to send Provisioning Failed message"); + } bt_mesh_atomic_set_bit(link.flags, LINK_INVALID); } @@ -596,7 +599,6 @@ static void prov_invite(const u8_t *data) if (prov_send(&buf)) { BT_ERR("%s, Failed to send capabilities", __func__); - prov_send_fail_msg(PROV_ERR_RESOURCES); return; } @@ -845,7 +847,6 @@ static void send_confirm(void) if (prov_send(&cfm)) { BT_ERR("%s, Unable to send Provisioning Confirm", __func__); - prov_send_fail_msg(PROV_ERR_RESOURCES); return; } @@ -857,7 +858,9 @@ static void send_input_complete(void) PROV_BUF(buf, 1); prov_buf_init(&buf, PROV_INPUT_COMPLETE); - prov_send(&buf); + if (prov_send(&buf)) { + BT_ERR("Failed to send Provisioning Input Complete"); + } } int bt_mesh_input_number(u32_t num) @@ -1108,7 +1111,6 @@ static void prov_random(const u8_t *data) if (prov_send(&rnd)) { BT_ERR("%s, Failed to send Provisioning Random", __func__); - prov_send_fail_msg(PROV_ERR_RESOURCES); return; } @@ -1192,7 +1194,10 @@ static void prov_data(const u8_t *data) net_idx, iv_index, addr); prov_buf_init(&msg, PROV_COMPLETE); - prov_send(&msg); + if (prov_send(&msg)) { + BT_ERR("Failed to send Provisioning Complete"); + return; + } /* Ignore any further PDUs on this link */ link.expect = 0U;