Bluetooth: host: GATT Lazyloading cleanup at disconnect
Mark the ram version of the ccc_cfg as free after ccc has been stored when a bonded device disconnects. If the device use lazy loading of settings then ccc_cfg was not cleaned up properly when a bonded device disconnects. This resulted in the ccc system ran out of ccc_cfg resources after having disconnected CONFIG_BT_MAX_CONN times. Signed-off-by: Kim Sekkelund <ksek@oticon.com>
This commit is contained in:
parent
29b42c5a2f
commit
41842dd174
1 changed files with 12 additions and 0 deletions
|
@ -4979,6 +4979,18 @@ void bt_gatt_disconnected(struct bt_conn *conn)
|
|||
bt_gatt_store_cf(conn);
|
||||
}
|
||||
|
||||
/* Make sure to clear the CCC entry when using lazy loading */
|
||||
if (IS_ENABLED(CONFIG_BT_SETTINGS_CCC_LAZY_LOADING) &&
|
||||
bt_addr_le_is_bonded(conn->id, &conn->le.dst)) {
|
||||
struct addr_with_id addr_with_id = {
|
||||
.addr = &conn->le.dst,
|
||||
.id = conn->id,
|
||||
};
|
||||
bt_gatt_foreach_attr(0x0001, 0xffff,
|
||||
remove_peer_from_attr,
|
||||
&addr_with_id);
|
||||
}
|
||||
|
||||
#if defined(CONFIG_BT_GATT_CLIENT)
|
||||
remove_subscriptions(conn);
|
||||
#endif /* CONFIG_BT_GATT_CLIENT */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue