OSDN Git Service

DO NOT MERGE BLE Secuity manager state machine generate wrong pairing success event.
authorZhihai Xu <zhihaixu@google.com>
Sat, 16 Nov 2013 02:57:28 +0000 (18:57 -0800)
committerZhihai Xu <zhihaixu@google.com>
Sat, 8 Mar 2014 07:43:48 +0000 (23:43 -0800)
 we call smp_proc_release_delay to setup a timer.
We will send a pair failure message to uplayer after the time expired.
Right before the time expire, the l2cap connection is disconnected
from remote device, we receive L2C_DISC, which will call smp_delay_terminate,
 smp_delay_terminate will send a pair success message to uplayer.
The fix is not to change the status if the remote device disconnect the link

bug:11716967
Change-Id: I8ca63599a170ec86913785aafea552301cec37df

stack/smp/smp_act.c

index 032f3ed..babd300 100644 (file)
@@ -905,10 +905,9 @@ void smp_delay_terminate(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
 
     btu_stop_timer (&p_cb->rsp_timer_ent);
 
-    /* if remote user terminate connection, finish SMP pairing as normal */
-    if (p_data->reason == HCI_ERR_PEER_USER)
-        p_cb->status = SMP_SUCCESS;
-    else
+    /* if remote user terminate connection, keep the previous status */
+    /* this is to avoid reporting reverse status to uplayer */
+    if (p_data->reason != HCI_ERR_PEER_USER)
         p_cb->status = SMP_CONN_TOUT;
 
     smp_proc_pairing_cmpl(p_cb);