Bluetooth: Mesh: Filter out unknown conns and disconns in pb-gatt srv
Ensure that another established connection with the mesh device don't mess up pb-gatt server state. Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
This commit is contained in:
parent
2b0fbd86a1
commit
c32ee7199f
1 changed files with 4 additions and 6 deletions
|
@ -100,7 +100,7 @@ static void gatt_connected(struct bt_conn *conn, uint8_t err)
|
|||
|
||||
bt_conn_get_info(conn, &info);
|
||||
if (info.role != BT_CONN_ROLE_PERIPHERAL || !service_registered ||
|
||||
bt_mesh_is_provisioned() || info.id != BT_ID_DEFAULT) {
|
||||
bt_mesh_is_provisioned() || info.id != BT_ID_DEFAULT || cli) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -115,14 +115,12 @@ static void gatt_disconnected(struct bt_conn *conn, uint8_t reason)
|
|||
|
||||
bt_conn_get_info(conn, &info);
|
||||
if (info.role != BT_CONN_ROLE_PERIPHERAL || !service_registered ||
|
||||
info.id != BT_ID_DEFAULT) {
|
||||
info.id != BT_ID_DEFAULT || !cli || cli->conn != conn) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (cli) {
|
||||
bt_mesh_proxy_role_cleanup(cli);
|
||||
cli = NULL;
|
||||
}
|
||||
bt_mesh_proxy_role_cleanup(cli);
|
||||
cli = NULL;
|
||||
|
||||
bt_mesh_pb_gatt_close(conn);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue