apache-mynewt-bot commented on issue #790: nimble/store: Fix nimble store 
behavior when CCCDs exceed static defined limit
URL: https://github.com/apache/mynewt-nimble/pull/790#issuecomment-606821185
 
 
   
   <!-- style-bot -->
   
   ## Style check summary
   
   ### Our coding style is 
[here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
   
   
   #### nimble/host/src/ble_store_util.c
   <details>
   
   ```diff
   @@ -306,31 +306,31 @@
        switch (event->event_code) {
        case BLE_STORE_EVENT_OVERFLOW:
            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:
   -                if (( rc = ble_gap_unpair_oldest_peer()) == BLE_HS_ENOENT) {
   -                    /* No peer to unpair. Here bonds do not exist but CCCDs 
are
   -                     * stored. Need to delete CCCDs to make space. */
   -                    rc = ble_store_util_subscribed_cccds(&peer_id_addr,
   +        case BLE_STORE_OBJ_TYPE_OUR_SEC:
   +        case BLE_STORE_OBJ_TYPE_PEER_SEC:
   +        case BLE_STORE_OBJ_TYPE_CCCD:
   +            if ((rc = ble_gap_unpair_oldest_peer()) == BLE_HS_ENOENT) {
   +                /* No peer to unpair. Here bonds do not exist but CCCDs are
   +                 * stored. Need to delete CCCDs to make space. */
   +                rc = ble_store_util_subscribed_cccds(&peer_id_addr,
                                                             &num_peers, 1);
   -                    if ((rc != 0) || (num_peers == 0)) {
   -                        return rc;
   -                    }
   -
   -                    union ble_store_key key = {0};
   -                    key.cccd.peer_addr = peer_id_addr;
   -
   -                    rc = ble_store_util_delete_all(BLE_STORE_OBJ_TYPE_CCCD, 
&key);
   -                    if (rc != 0) {
   -                        return rc;
   -                    }
   +                if ((rc != 0) || (num_peers == 0)) {
   +                    return rc;
                    }
    
   -                return rc;
   -
   -            default:
   -                return BLE_HS_EUNKNOWN;
   +                union ble_store_key key = {0};
   +                key.cccd.peer_addr = peer_id_addr;
   +
   +                rc = ble_store_util_delete_all(BLE_STORE_OBJ_TYPE_CCCD, 
&key);
   +                if (rc != 0) {
   +                    return rc;
   +                }
   +            }
   +
   +            return rc;
   +
   +        default:
   +            return BLE_HS_EUNKNOWN;
            }
    
        case BLE_STORE_EVENT_FULL:
   ```
   
   </details>

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to