ble_mesh: fix provisioning send error handling

This commit is contained in:
lly 2019-09-02 14:42:35 +08:00
parent 1c06494293
commit edf0b9ee02

View File

@ -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;