1) With SDK14 and SDK15, we're seeing that the connection handle for the last bonded connection is kept indefinitely until reset. The connection handle does not get set to invalid when the corresponding peer has disconnected. I am definitely seeing the BLE_GAP_EVT_DISCONNECTED, which I would assume should invalidate the handle.
I'm not sure if this is by design.
2) This means that pm_peers_delete() will not delete all bonds, because it stops when it encounters a valid connection handle for a bond.
It (1) is by design, then it would be useful for pm_peers_delete() to check if it the handle corresponds to an active connection, perhaps with
If that is not a reliable test, it would still be useful to skip the peer that has a valid handle, and continue deleting the rest.
We're considering this alternate implementation of im_peer_free().