ccollins476ad commented on a change in pull request #279: BLE Host - Policy for 
SM key overflow
URL: 
https://github.com/apache/incubator-mynewt-core/pull/279#discussion_r119369837
 
 

 ##########
 File path: net/nimble/host/src/ble_sm.c
 ##########
 @@ -892,6 +895,72 @@ ble_sm_key_dist(struct ble_sm_proc *proc,
     }
 }
 
+static int
+ble_sm_chk_store_overflow_once(int is_our_sec, uint16_t conn_handle)
+{
+#if !MYNEWT_VAL(BLE_SM_BONDING)
+    return 0;
+#endif
+
+    struct ble_store_status_event event;
+    int obj_type;
+    int count;
+    int rc;
+
+    if (is_our_sec) {
+        obj_type = BLE_STORE_OBJ_TYPE_OUR_SEC;
+    } else {
+        obj_type = BLE_STORE_OBJ_TYPE_PEER_SEC;
+    }
+
+    rc = ble_store_util_count(obj_type, &count);
+    if (rc != 0) {
+        return rc;
+    }
+
+    /* Pessimistically assume all active procs will persist bonds. */
+    ble_hs_lock();
+    count += ble_sm_num_procs();
 
 Review comment:
   It is initialized by the prior call to `ble_store_util_count()`.
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to