prasad-alatkar commented on a change in pull request #790: nimble/store: Fix 
nimble store behavior when CCCDs exceed static defined limit

 File path: nimble/host/src/ble_store_util.c
 @@ -230,16 +315,43 @@ ble_store_util_delete_oldest_peer(void)
 ble_store_util_status_rr(struct ble_store_status_event *event, void *arg)
+    int rc = BLE_HS_EUNKNOWN;
+    ble_addr_t peer_id_addr;
+    int num_peers;
     switch (event->event_code) {
         switch (event->overflow.obj_type) {
-            case BLE_STORE_OBJ_TYPE_OUR_SEC:
-            case BLE_STORE_OBJ_TYPE_PEER_SEC:
-            case BLE_STORE_OBJ_TYPE_CCCD:
-                return ble_gap_unpair_oldest_peer();
-            default:
-                return BLE_HS_EUNKNOWN;
+            return ble_gap_unpair_oldest_peer();
+        case BLE_STORE_OBJ_TYPE_CCCD:
+            if ((rc = ble_gap_unpair_oldest_peer()) == BLE_HS_ENOENT) {
 Review comment:
   @rymanluk @h2zero , disregard my earlier comment, yes current peer will be 
unpaired, and we should simply return error in that case.
   I was thinking of adding utility function (`ble_store_clean_old_cccd`) which 
will delete CCCDs of all unbonded peers. This can be called first in case of 
`CCCD overflow` and if it fails to delete peer then we can continue with  
modified `ble_gap_unpair_oldest_peer()`. Please let me know your views on it.

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:

With regards,
Apache Git Services

Reply via email to