fix(ble/bluedroid): delete unused pending_queue

(cherry picked from commit d9a88c7414)

Co-authored-by: zhiweijian <zhiweijian@espressif.com>
This commit is contained in:
Zhi Wei Jian
2026-01-07 17:23:59 +08:00
parent 3fd58ab366
commit 54082327ca
4 changed files with 9 additions and 100 deletions
@@ -181,9 +181,6 @@ void gatt_free(void)
p_tcb->pending_enc_clcb = NULL;
#endif // (SMP_INCLUDED == TRUE)
fixed_queue_free(p_tcb->pending_ind_q, NULL);
p_tcb->pending_ind_q = NULL;
btu_free_timer(&p_tcb->conf_timer_ent);
memset(&p_tcb->conf_timer_ent, 0, sizeof(TIMER_LIST_ENT));
@@ -418,9 +415,6 @@ BOOLEAN gatt_act_connect (tGATT_REG *p_reg, BD_ADDR bd_addr,
fixed_queue_free(p_tcb->pending_enc_clcb, NULL);
}
#endif // (SMP_INCLUDED == TRUE)
if(p_tcb->pending_ind_q != NULL) {
fixed_queue_free(p_tcb->pending_ind_q, NULL);
}
gatt_tcb_free(p_tcb);
}
@@ -1633,33 +1633,6 @@ static void gatts_proc_srv_chg_ind_ack(tGATT_TCB *p_tcb )
}
}
/*******************************************************************************
**
** Function gatts_chk_pending_ind
**
** Description This function check any pending indication needs to be sent if
** there is a pending indication then sent the indication
**
** Returns void
**
*******************************************************************************/
static void gatts_chk_pending_ind(tGATT_TCB *p_tcb )
{
#if (GATTS_INCLUDED == TRUE)
tGATT_VALUE *p_buf = (tGATT_VALUE *)fixed_queue_try_peek_first(p_tcb->pending_ind_q);
GATT_TRACE_DEBUG("gatts_chk_pending_ind");
if (p_buf ) {
GATTS_HandleValueIndication (p_buf->conn_id,
p_buf->handle,
p_buf->len,
p_buf->value);
osi_free(fixed_queue_try_remove_from_queue(p_tcb->pending_ind_q,
p_buf));
}
#endif ///GATTS_INCLUDED == TRUE
}
/*******************************************************************************
**
** Function gatts_proc_ind_ack
@@ -1686,7 +1659,6 @@ static BOOLEAN gatts_proc_ind_ack(tGATT_TCB *p_tcb, UINT16 ack_handle)
#endif /* GATTS_ROBUST_CACHING_ENABLED */
}
gatts_chk_pending_ind(p_tcb);
return continue_processing;
}
@@ -80,30 +80,6 @@ static const UINT8 base_uuid[LEN_UUID_128] = {0xFB, 0x34, 0x9B, 0x5F, 0x80, 0x0
static UINT8 gatt_tcb_id[GATT_MAX_PHY_CHANNEL / 8 + 1];
/*******************************************************************************
**
** Function gatt_free_pending_ind
**
** Description Free all pending indications
**
** Returns None
**
*******************************************************************************/
void gatt_free_pending_ind(tGATT_TCB *p_tcb)
{
GATT_TRACE_DEBUG("gatt_free_pending_ind");
if (p_tcb->pending_ind_q == NULL) {
return;
}
/* release all queued indications */
while (!fixed_queue_is_empty(p_tcb->pending_ind_q)) {
osi_free(fixed_queue_dequeue(p_tcb->pending_ind_q, 0));
}
fixed_queue_free(p_tcb->pending_ind_q, NULL);
p_tcb->pending_ind_q = NULL;
}
#if (SMP_INCLUDED == TRUE)
/*******************************************************************************
**
@@ -129,7 +105,7 @@ void gatt_free_pending_enc_queue(tGATT_TCB *p_tcb)
p_tcb->pending_enc_clcb = NULL;
}
#endif // (SMP_INCLUDED == TRUE)
#if (GATTS_INCLUDED == TRUE)
/*******************************************************************************
**
** Function gatt_free_pending_prepare_write_queue
@@ -155,6 +131,7 @@ void gatt_free_pending_prepare_write_queue(tGATT_TCB *p_tcb)
p_tcb->prepare_write_record.total_num = 0;
p_tcb->prepare_write_record.error_code_app = GATT_SUCCESS;
}
#endif // (GATTS_INCLUDED == TRUE)
#if (GATTS_INCLUDED == TRUE)
/*******************************************************************************
@@ -253,27 +230,6 @@ tGATTS_PENDING_NEW_SRV_START *gatt_sr_is_new_srv_chg(tBT_UUID *p_app_uuid128, tB
}
#endif // (GATTS_INCLUDED == TRUE)
/*******************************************************************************
**
** Function gatt_add_pending_ind
**
** Description Add a pending indication
**
** Returns Pointer to the current pending indication buffer, NULL no buffer available
**
*******************************************************************************/
tGATT_VALUE *gatt_add_pending_ind(tGATT_TCB *p_tcb, tGATT_VALUE *p_ind)
{
tGATT_VALUE *p_buf;
GATT_TRACE_DEBUG ("gatt_add_pending_ind");
if ((p_buf = (tGATT_VALUE *)osi_malloc((UINT16)sizeof(tGATT_VALUE))) != NULL) {
GATT_TRACE_DEBUG ("enqueue a pending indication");
memcpy(p_buf, p_ind, sizeof(tGATT_VALUE));
fixed_queue_enqueue(p_tcb->pending_ind_q, p_buf, FIXED_QUEUE_MAX_TIMEOUT);
}
return p_buf;
}
#if (GATTS_INCLUDED == TRUE)
/*******************************************************************************
**
@@ -821,23 +777,10 @@ BOOLEAN gatt_is_srv_chg_ind_pending (tGATT_TCB *p_tcb)
{
BOOLEAN srv_chg_ind_pending = FALSE;
GATT_TRACE_DEBUG("gatt_is_srv_chg_ind_pending is_queue_empty=%d",
fixed_queue_is_empty(p_tcb->pending_ind_q));
GATT_TRACE_DEBUG("gatt_is_srv_chg_ind_pending is_queue_empty=%d_%d", p_tcb->indicate_handle, gatt_cb.handle_of_h_r);
if (p_tcb->indicate_handle == gatt_cb.handle_of_h_r) {
srv_chg_ind_pending = TRUE;
} else if (! fixed_queue_is_empty(p_tcb->pending_ind_q)) {
list_t *list = fixed_queue_get_list(p_tcb->pending_ind_q);
for (const list_node_t *node = list_begin(list);
node != list_end(list);
node = list_next(node)) {
tGATT_VALUE *p_buf = (tGATT_VALUE *)list_node(node);
if (p_buf->handle == gatt_cb.handle_of_h_r)
{
srv_chg_ind_pending = TRUE;
break;
}
}
}
GATT_TRACE_DEBUG("srv_chg_ind_pending = %d", srv_chg_ind_pending);
@@ -1089,7 +1032,6 @@ tGATT_TCB *gatt_allocate_tcb_by_bdaddr(BD_ADDR bda, tBT_TRANSPORT transport)
#if (SMP_INCLUDED == TRUE)
p_tcb->pending_enc_clcb = fixed_queue_new(QUEUE_SIZE_MAX);
#endif // (SMP_INCLUDED == TRUE)
p_tcb->pending_ind_q = fixed_queue_new(QUEUE_SIZE_MAX);
p_tcb->in_use = TRUE;
p_tcb->tcb_idx = i;
p_tcb->transport = transport;
@@ -2377,11 +2319,12 @@ void gatt_cleanup_upon_disc(BD_ADDR bda, UINT16 reason, tBT_TRANSPORT transport)
btu_free_timer (&p_tcb->ind_ack_timer_ent);
btu_free_timer (&p_tcb->conf_timer_ent);
gatt_free_pending_ind(p_tcb);
#if (SMP_INCLUDED == TRUE)
gatt_free_pending_enc_queue(p_tcb);
#endif // (SMP_INCLUDED == TRUE)
#if (GATTS_INCLUDED == TRUE)
gatt_free_pending_prepare_write_queue(p_tcb);
#endif // (GATTS_INCLUDED == TRUE)
#if (GATTS_INCLUDED == TRUE)
fixed_queue_free(p_tcb->sr_cmd.multi_rsp_q, osi_free_func);
p_tcb->sr_cmd.multi_rsp_q = NULL;
@@ -399,7 +399,6 @@ typedef struct {
tGATT_SR_CMD sr_cmd;
#endif ///GATTS_INCLUDED == TRUE
UINT16 indicate_handle;
fixed_queue_t *pending_ind_q;
TIMER_LIST_ENT conf_timer_ent; /* peer confirm to indication timer */
@@ -410,17 +409,19 @@ typedef struct {
TIMER_LIST_ENT ind_ack_timer_ent; /* local app confirm to indication timer */
UINT8 pending_cl_req;
UINT8 next_slot_inq; /* index of next available slot in queue */
#if (GATTS_ROBUST_CACHING_ENABLED == TRUE)
/* client supported feature */
UINT8 cl_supp_feat;
/* server supported feature */
UINT8 sr_supp_feat;
/* if false, should handle database out of sync */
BOOLEAN is_robust_cache_change_aware;
#endif // (GATTS_ROBUST_CACHING_ENABLED == TRUE)
BOOLEAN in_use;
UINT8 tcb_idx;
#if (GATTS_INCLUDED == TRUE)
tGATT_PREPARE_WRITE_RECORD prepare_write_record; /* prepare write packets record */
#endif // (GATTS_INCLUDED == TRUE)
} tGATT_TCB;
@@ -660,7 +661,6 @@ extern tGATTS_SRV_CHG *gatt_is_bda_in_the_srv_chg_clt_list (BD_ADDR bda);
extern BOOLEAN gatt_find_the_connected_bda(UINT8 start_idx, BD_ADDR bda, UINT8 *p_found_idx, tBT_TRANSPORT *p_transport);
extern void gatt_set_srv_chg(void);
extern void gatt_delete_dev_from_srv_chg_clt_list(BD_ADDR bd_addr);
extern tGATT_VALUE *gatt_add_pending_ind(tGATT_TCB *p_tcb, tGATT_VALUE *p_ind);
extern tGATTS_PENDING_NEW_SRV_START *gatt_add_pending_new_srv_start( tGATTS_HNDL_RANGE *p_new_srv_start);
extern void gatt_free_srvc_db_buffer_app_id(tBT_UUID *p_app_id);
extern BOOLEAN gatt_update_listen_mode(void);