mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-01 03:34:32 +02:00
Nimble: Added change to give time to allocate buffers, in case previous
allocation fails Closes https://github.com/espressif/esp-idf/issues/10849
This commit is contained in:
@@ -240,19 +240,23 @@ static struct os_mbuf *ble_hci_trans_acl_buf_alloc(void)
|
||||
|
||||
static void ble_hci_rx_acl(uint8_t *data, uint16_t len)
|
||||
{
|
||||
struct os_mbuf *m;
|
||||
struct os_mbuf *m = NULL;
|
||||
int rc;
|
||||
int sr;
|
||||
if (len < BLE_HCI_DATA_HDR_SZ || len > MYNEWT_VAL(BLE_ACL_BUF_SIZE)) {
|
||||
return;
|
||||
}
|
||||
|
||||
m = ble_hci_trans_acl_buf_alloc();
|
||||
do {
|
||||
m = ble_hci_trans_acl_buf_alloc();
|
||||
|
||||
if (!m) {
|
||||
ESP_LOGD(TAG,"Failed to allocate buffer, retrying \n");
|
||||
/* Give some time to free buffer and try again */
|
||||
vTaskDelay(1);
|
||||
}
|
||||
}while(!m);
|
||||
|
||||
if (!m) {
|
||||
ESP_LOGE(TAG, "%s failed to allocate ACL buffers; increase ACL_BUF_COUNT", __func__);
|
||||
return;
|
||||
}
|
||||
if ((rc = os_mbuf_append(m, data, len)) != 0) {
|
||||
ESP_LOGE(TAG, "%s failed to os_mbuf_append; rc = %d", __func__, rc);
|
||||
os_mbuf_free_chain(m);
|
||||
|
Reference in New Issue
Block a user