Skip to content

Commit

Permalink
Merge branch 'fix/ble_mesh_24_76_v5.2' into 'release/v5.2'
Browse files Browse the repository at this point in the history
fix(ble_mesh): fixed BLEMESH24-76_v5.2

See merge request espressif/esp-idf!32227
  • Loading branch information
Isl2017 committed Jul 22, 2024
2 parents e7fa887 + f0bf1d3 commit 6159750
Showing 1 changed file with 23 additions and 12 deletions.
35 changes: 23 additions & 12 deletions components/bt/esp_ble_mesh/core/net.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/*
* SPDX-FileCopyrightText: 2017 Intel Corporation
* SPDX-FileContributor: 2018-2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileContributor: 2018-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand Down Expand Up @@ -1129,23 +1129,34 @@ int bt_mesh_net_send(struct bt_mesh_net_tx *tx, struct net_buf *buf,
if (((IS_ENABLED(CONFIG_BLE_MESH_NODE) && bt_mesh_is_provisioned()) ||
(IS_ENABLED(CONFIG_BLE_MESH_PROVISIONER) && bt_mesh_is_provisioner_en())) &&
(bt_mesh_fixed_group_match(tx->ctx->addr) || bt_mesh_elem_find(tx->ctx->addr))) {
if (cb && cb->start) {
cb->start(0, 0, cb_data);
}
/**
* If the target address isn't a unicast address, then the callback function
* will be called by `adv task` in place of here, to avoid the callback function
* being called twice.
* See BLEMESH24-76 for more details.
*/
if (BLE_MESH_ADDR_IS_UNICAST(tx->ctx->addr)) {
if (cb && cb->start) {
cb->start(0, 0, cb_data);
}

net_buf_slist_put(&bt_mesh.local_queue, net_buf_ref(buf));
net_buf_slist_put(&bt_mesh.local_queue, net_buf_ref(buf));

if (cb && cb->end) {
cb->end(0, cb_data);
}
if (cb && cb->end) {
cb->end(0, cb_data);
}

bt_mesh_net_local();
bt_mesh_net_local();

err = 0;

err = 0;
/* If it is a group address, it still needs to be relayed */
if (BLE_MESH_ADDR_IS_UNICAST(tx->ctx->addr)) {
goto done;
} else {
net_buf_slist_put(&bt_mesh.local_queue, net_buf_ref(buf));
bt_mesh_net_local();
}

err = 0;
}

if ((bearer & BLE_MESH_ADV_BEARER) &&
Expand Down

0 comments on commit 6159750

Please # to comment.