Skip to content

Commit 28ef52c

Browse files
PavelVPVrlubos
authored andcommitted
[nrf fromtree] 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 <[email protected]> (cherry picked from commit c32ee71)
1 parent 4e1b595 commit 28ef52c

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

subsys/bluetooth/mesh/pb_gatt_srv.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ static void gatt_connected(struct bt_conn *conn, uint8_t err)
100100

101101
bt_conn_get_info(conn, &info);
102102
if (info.role != BT_CONN_ROLE_PERIPHERAL || !service_registered ||
103-
bt_mesh_is_provisioned() || info.id != BT_ID_DEFAULT) {
103+
bt_mesh_is_provisioned() || info.id != BT_ID_DEFAULT || cli) {
104104
return;
105105
}
106106

@@ -115,14 +115,12 @@ static void gatt_disconnected(struct bt_conn *conn, uint8_t reason)
115115

116116
bt_conn_get_info(conn, &info);
117117
if (info.role != BT_CONN_ROLE_PERIPHERAL || !service_registered ||
118-
info.id != BT_ID_DEFAULT) {
118+
info.id != BT_ID_DEFAULT || !cli || cli->conn != conn) {
119119
return;
120120
}
121121

122-
if (cli) {
123-
bt_mesh_proxy_role_cleanup(cli);
124-
cli = NULL;
125-
}
122+
bt_mesh_proxy_role_cleanup(cli);
123+
cli = NULL;
126124

127125
bt_mesh_pb_gatt_close(conn);
128126

0 commit comments

Comments
 (0)