]> granicus.if.org Git - esp-idf/commitdiff
ble_mesh: fix provisioning send error handling
authorlly <lly@espressif.com>
Mon, 2 Sep 2019 06:42:35 +0000 (14:42 +0800)
committerlly <lly@espressif.com>
Mon, 9 Sep 2019 09:15:16 +0000 (17:15 +0800)
components/bt/esp_ble_mesh/mesh_core/prov.c

index c7c1dae4dcdc57e5cdaba741ff6893eebc592358..b270519365914d304be2a9d49288362ceedc2449 100644 (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;