You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2019/11/15 14:13:27 UTC

[GitHub] [mynewt-nimble] andrzej-kaczmarek commented on a change in pull request #655: nimble/ll: Fix for race which leads to assert in ble_ll_conn

andrzej-kaczmarek commented on a change in pull request #655: nimble/ll: Fix for race which leads to assert in ble_ll_conn
URL: https://github.com/apache/mynewt-nimble/pull/655#discussion_r346839603
 
 

 ##########
 File path: nimble/controller/src/ble_ll_conn.c
 ##########
 @@ -1808,13 +1810,33 @@ ble_ll_conn_end(struct ble_ll_conn_sm *connsm, uint8_t ble_err)
 {
     struct os_mbuf *m;
     struct os_mbuf_pkthdr *pkthdr;
+    os_sr_t sr;
 #if MYNEWT_VAL(BLE_LL_STRICT_CONN_SCHEDULING)
     os_sr_t sr;
 #endif
 
     /* Remove scheduler events just in case */
     ble_ll_sched_rmv_elem(&connsm->conn_sch);
 
+    /* In case of the supervision timeout we shall make sure
+     * that there is no ongoing connection event. It could happen
+     * because we scheduled connection event before checking connection timeout.
+     * If connection event managed to start, let us drop it.
+     */
+    OS_ENTER_CRITICAL(sr);
+    if (g_ble_ll_conn_cur_sm == connsm) {
+        /* Disable the PHY */
+        ble_phy_disable();
+        /* Disable the wfr timer */
+        ble_ll_wfr_disable();
+        /* Link-layer is in standby state now */
+        ble_ll_state_set(BLE_LL_STATE_STANDBY);
+        /* Set current LL connection to NULL */
 
 Review comment:
   all these comments are redundant since all calls are self-explanatory
   
   and seems like you just copied this from `ble_ll_conn_current_sm_over` so why not make it a common helper?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services