mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
ble_mesh: fix not sending all segments through the Friend Queue
This commit is contained in:
parent
f449cb7843
commit
e152df43f1
@ -391,8 +391,6 @@ static int send_seg(struct bt_mesh_net_tx *net_tx, struct net_buf_simple *sdu,
|
||||
net_buf_add_mem(seg, sdu->data, len);
|
||||
net_buf_simple_pull(sdu, len);
|
||||
|
||||
tx->seg[seg_o] = net_buf_ref(seg);
|
||||
|
||||
if (IS_ENABLED(CONFIG_BLE_MESH_NODE) && bt_mesh_is_provisioned()) {
|
||||
if (IS_ENABLED(CONFIG_BLE_MESH_FRIEND)) {
|
||||
enum bt_mesh_friend_pdu_type type;
|
||||
@ -411,11 +409,13 @@ static int send_seg(struct bt_mesh_net_tx *net_tx, struct net_buf_simple *sdu,
|
||||
* out through the Friend Queue.
|
||||
*/
|
||||
net_buf_unref(seg);
|
||||
return 0;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tx->seg[seg_o] = net_buf_ref(seg);
|
||||
|
||||
BT_DBG("Sending %u/%u", seg_o, tx->seg_n);
|
||||
|
||||
err = bt_mesh_net_send(net_tx, seg,
|
||||
@ -428,6 +428,23 @@ static int send_seg(struct bt_mesh_net_tx *net_tx, struct net_buf_simple *sdu,
|
||||
}
|
||||
}
|
||||
|
||||
/* This can happen if segments only went into the Friend Queue */
|
||||
if (IS_ENABLED(CONFIG_BLE_MESH_FRIEND) && !tx->seg[0]) {
|
||||
seg_tx_reset(tx);
|
||||
/* If there was a callback notify sending immediately since
|
||||
* there's no other way to track this (at least currently)
|
||||
* with the Friend Queue.
|
||||
*/
|
||||
if (cb) {
|
||||
if (cb->start) {
|
||||
cb->start(0, 0, cb_data);
|
||||
}
|
||||
if (cb->end) {
|
||||
cb->end(0, cb_data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (IS_ENABLED(CONFIG_BLE_MESH_NODE) && bt_mesh_is_provisioned()) {
|
||||
if (IS_ENABLED(CONFIG_BLE_MESH_LOW_POWER) &&
|
||||
bt_mesh_lpn_established()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user