Bluetooth: Mesh: Limit number of Bluetooth connections used by mesh

When a remote devices establishes a ble connection with the mesh device
with default identity and there are more available connection slots, the
mesh stack will try to restart connectable advertisements (either
pb-gatt or proxy depending on the provisioning state). This makes
difficult for an application to advertise own connectable advertisements
as the mesh stack will not let a chance the app to start advertising.

This change adds a Kconfig option that limits number of connection slots
that the mesh stack can use for own connectable advertisements.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
This commit is contained in:
Pavel Vasilyev 2022-11-23 13:46:55 +01:00 committed by Carles Cufí
commit 2b0fbd86a1
6 changed files with 15 additions and 7 deletions

View file

@ -556,7 +556,7 @@ static int gatt_proxy_advertise(struct bt_mesh_subnet *sub)
BT_DBG("");
if (bt_mesh_proxy_conn_count_get() == CONFIG_BT_MAX_CONN) {
if (!bt_mesh_proxy_has_avail_conn()) {
BT_DBG("Connectable advertising deferred (max connections)");
return -ENOMEM;
}
@ -847,7 +847,7 @@ static void gatt_connected(struct bt_conn *conn, uint8_t err)
proxy_msg_recv);
/* Try to re-enable advertising in case it's possible */
if (bt_mesh_proxy_conn_count_get() < CONFIG_BT_MAX_CONN) {
if (bt_mesh_proxy_has_avail_conn()) {
bt_mesh_adv_gatt_update();
}
}