From ddfc19d531f572d5251e703a55ff45b443aceebb Mon Sep 17 00:00:00 2001 From: XieWenxiang Date: Thu, 31 Dec 2020 14:45:23 +0800 Subject: [PATCH] component/bt: fix Blufi sends customer data will congested when connection is broken --- .../bt/host/bluedroid/btc/profile/esp/blufi/blufi_prf.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/components/bt/host/bluedroid/btc/profile/esp/blufi/blufi_prf.c b/components/bt/host/bluedroid/btc/profile/esp/blufi/blufi_prf.c index dec4caceae..6150c651cd 100644 --- a/components/bt/host/bluedroid/btc/profile/esp/blufi/blufi_prf.c +++ b/components/bt/host/bluedroid/btc/profile/esp/blufi/blufi_prf.c @@ -537,6 +537,13 @@ void btc_blufi_send_encap(uint8_t type, uint8_t *data, int total_data_len) } 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) { btc_blufi_send_notify((uint8_t *)hdr, ((hdr->fc & BLUFI_FC_CHECK) ?