From 15fae990c12edf5c87d8fae28bf6d55cff679607 Mon Sep 17 00:00:00 2001 From: baohongde Date: Wed, 26 Sep 2018 11:59:54 +0800 Subject: [PATCH] component/bt: Fix BTU task watchdog timeout after pair with iphone Create a new pending queue, then re-submit pending requests in old pending queue,preventing new events being inserted into it. Closes https://github.com/espressif/esp-idf/issues/2191 --- components/bt/bluedroid/stack/btm/btm_sec.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/components/bt/bluedroid/stack/btm/btm_sec.c b/components/bt/bluedroid/stack/btm/btm_sec.c index 29b2ac50f..642edf3b1 100644 --- a/components/bt/bluedroid/stack/btm/btm_sec.c +++ b/components/bt/bluedroid/stack/btm/btm_sec.c @@ -2761,9 +2761,9 @@ void btm_sec_check_pending_reqs (void) /* Now, re-submit anything in the mux queue */ bq = btm_cb.sec_pending_q; - if (!btm_cb.sec_pending_q) { - btm_cb.sec_pending_q = fixed_queue_new(QUEUE_SIZE_MAX); - } + + btm_cb.sec_pending_q = fixed_queue_new(QUEUE_SIZE_MAX); + while ((p_e = (tBTM_SEC_QUEUE_ENTRY *)fixed_queue_try_dequeue(bq)) != NULL) { /* Check that the ACL is still up before starting security procedures */ @@ -2784,6 +2784,7 @@ void btm_sec_check_pending_reqs (void) osi_free (p_e); } + fixed_queue_free(bq, NULL); } } #endif ///SMP_INCLUDED == TRUE