system/bt
修訂 | ff2b23178f68303bcdb5a3c2830cc7758b897a96 (tree) |
---|---|
時間 | 2016-08-30 09:12:25 |
作者 | Subramanian Srinivasan <subrsrin@code...> |
Commiter | Subramanian Srinivasan |
Dequeues direct connection request during cancel conn operation
When cancel connection request for a device is sent
from an app and if the current pending connection
request's BD address does not match with this device,
the entries of the connection request pending queue
are also checked. If BD address match occurs with an
entry in the connection request queue, the entry is
removed from the queue.
CRs-Fixed: 1060313
Change-Id: I1bf50a424d86ac53a5201fff742c822f4c8d1c0b
@@ -701,6 +701,37 @@ void btm_ble_enqueue_direct_conn_req(void *p_param) | ||
701 | 701 | } |
702 | 702 | /******************************************************************************* |
703 | 703 | ** |
704 | +** Function btm_ble_dequeue_direct_conn_req | |
705 | +** | |
706 | +** Description This function dequeues the direct connection request | |
707 | +** | |
708 | +** Returns None. | |
709 | +** | |
710 | +*******************************************************************************/ | |
711 | +void btm_ble_dequeue_direct_conn_req(BD_ADDR rem_bda) | |
712 | +{ | |
713 | + if (fixed_queue_is_empty(btm_cb.ble_ctr_cb.conn_pending_q)) | |
714 | + return; | |
715 | + | |
716 | + list_t *list = fixed_queue_get_list(btm_cb.ble_ctr_cb.conn_pending_q); | |
717 | + for (const list_node_t *node = list_begin(list); node != list_end(list); | |
718 | + node = list_next(node)) { | |
719 | + tBTM_BLE_CONN_REQ *p_req = (tBTM_BLE_CONN_REQ *)list_node(node); | |
720 | + tL2C_LCB *p_lcb = (tL2C_LCB *)p_req->p_param; | |
721 | + if ((p_lcb == NULL) || (!p_lcb->in_use)) { | |
722 | + continue; | |
723 | + } | |
724 | + //If BD address matches | |
725 | + if (!memcmp (rem_bda, p_lcb->remote_bd_addr, BD_ADDR_LEN)) { | |
726 | + fixed_queue_try_remove_from_queue(btm_cb.ble_ctr_cb.conn_pending_q, p_req); | |
727 | + l2cu_release_lcb((tL2C_LCB *)p_req->p_param); | |
728 | + osi_free((void *)p_req); | |
729 | + break; | |
730 | + } | |
731 | + } | |
732 | +} | |
733 | +/******************************************************************************* | |
734 | +** | |
704 | 735 | ** Function btm_send_pending_direct_conn |
705 | 736 | ** |
706 | 737 | ** Description This function send the pending direct connection request in queue |
@@ -433,6 +433,7 @@ extern void btm_ble_update_link_topology_mask(UINT8 role, BOOLEAN increase); | ||
433 | 433 | /* direct connection utility */ |
434 | 434 | extern BOOLEAN btm_send_pending_direct_conn(void); |
435 | 435 | extern void btm_ble_enqueue_direct_conn_req(void *p_param); |
436 | +extern void btm_ble_dequeue_direct_conn_req(BD_ADDR rem_bda); | |
436 | 437 | |
437 | 438 | /* BLE address management */ |
438 | 439 | extern void btm_gen_resolvable_private_addr (void *p_cmd_cplt_cback); |
@@ -249,6 +249,8 @@ BOOLEAN gatt_disconnect (tGATT_TCB *p_tcb) | ||
249 | 249 | { |
250 | 250 | gatt_set_ch_state(p_tcb, GATT_CH_CLOSING); |
251 | 251 | ret = L2CA_CancelBleConnectReq (p_tcb->peer_bda); |
252 | + if (!ret) | |
253 | + gatt_set_ch_state(p_tcb, GATT_CH_CLOSE); | |
252 | 254 | } |
253 | 255 | } |
254 | 256 | else |
@@ -57,17 +57,17 @@ BOOLEAN L2CA_CancelBleConnectReq (BD_ADDR rem_bda) | ||
57 | 57 | /* There can be only one BLE connection request outstanding at a time */ |
58 | 58 | if (btm_ble_get_conn_st() == BLE_CONN_IDLE) |
59 | 59 | { |
60 | - L2CAP_TRACE_WARNING ("L2CA_CancelBleConnectReq - no connection pending"); | |
60 | + L2CAP_TRACE_WARNING ("%s - no connection pending", __func__); | |
61 | 61 | return(FALSE); |
62 | 62 | } |
63 | 63 | |
64 | 64 | if (memcmp (rem_bda, l2cb.ble_connecting_bda, BD_ADDR_LEN)) |
65 | 65 | { |
66 | - L2CAP_TRACE_WARNING ("L2CA_CancelBleConnectReq - different BDA Connecting: %08x%04x Cancel: %08x%04x", | |
66 | + L2CAP_TRACE_WARNING ("%s - different BDA Connecting: %08x%04x Cancel: %08x%04x", __func__, | |
67 | 67 | (l2cb.ble_connecting_bda[0]<<24)+(l2cb.ble_connecting_bda[1]<<16)+(l2cb.ble_connecting_bda[2]<<8)+l2cb.ble_connecting_bda[3], |
68 | 68 | (l2cb.ble_connecting_bda[4]<<8)+l2cb.ble_connecting_bda[5], |
69 | 69 | (rem_bda[0]<<24)+(rem_bda[1]<<16)+(rem_bda[2]<<8)+rem_bda[3], (rem_bda[4]<<8)+rem_bda[5]); |
70 | - | |
70 | + btm_ble_dequeue_direct_conn_req(rem_bda); | |
71 | 71 | return(FALSE); |
72 | 72 | } |
73 | 73 |