Merge branch 'bugfix/blufi_notify_v5.0' into 'release/v5.0'

BluFi : Fixed hdr getting free twice (v5.0)

See merge request espressif/esp-idf!22448
This commit is contained in:
Wang Meng Yang 2023-02-21 18:17:50 +08:00
commit b94db7a64e
2 changed files with 8 additions and 6 deletions

View File

@ -385,8 +385,6 @@ void esp_blufi_send_encap(void *arg)
retry:
if (blufi_env.is_connected == false) {
BTC_TRACE_WARNING("%s ble connection is broken\n", __func__);
osi_free(hdr);
hdr = NULL;
return;
}
if (esp_ble_get_cur_sendable_packets_num(BTC_GATT_GET_CONN_ID(blufi_env.conn_id)) > 0) {

View File

@ -432,9 +432,15 @@ void esp_blufi_send_notify(void *arg)
struct pkt_info *pkts = (struct pkt_info *) arg;
struct os_mbuf *om;
om = ble_hs_mbuf_from_flat(pkts->pkt, pkts->pkt_len);
if (om == NULL) {
ESP_LOGE(TAG, "Error in allocating memory");
return;
}
int rc = 0;
rc = ble_gatts_notify_custom(conn_handle, gatt_values[1].val_handle, om);
assert(rc == 0);
rc = ble_gatts_notify_custom(blufi_env.conn_id, gatt_values[1].val_handle, om);
if (rc != 0) {
ESP_LOGE(TAG, "Error in sending notification");
}
}
void esp_blufi_disconnect(void)
@ -449,8 +455,6 @@ void esp_blufi_send_encap(void *arg)
struct blufi_hdr *hdr = (struct blufi_hdr *)arg;
if (blufi_env.is_connected == false) {
BTC_TRACE_WARNING("%s ble connection is broken\n", __func__);
osi_free(hdr);
hdr = NULL;
return;
}
btc_blufi_send_notify((uint8_t *)hdr,