From 5fa084b0a81cdb684bb8e8c5ee5bf2fc356c0182 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Fri, 17 Jul 2020 12:08:14 -0700 Subject: [PATCH] shared/gatt-client: Fix handling of service changed When handling multiple service changed multiple discovery operations would be performed but at the end of each one the hash would be read which not only would create extra traffic but also prevents the code to properly detection services disappering. --- src/shared/gatt-client.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/shared/gatt-client.c b/src/shared/gatt-client.c index 409a3ee57..f6cff5014 100644 --- a/src/shared/gatt-client.c +++ b/src/shared/gatt-client.c @@ -1460,8 +1460,10 @@ static bool read_db_hash(struct discovery_op *op) struct bt_gatt_client *client = op->client; bt_uuid_t uuid; - /* Check if hash was already read */ - if (op->hash) + /* Check if hash was already been read or there are more services to + * process. + */ + if (op->hash || !queue_isempty(client->svc_chngd_queue)) return false; bt_uuid16_create(&uuid, GATT_CHARAC_DB_HASH); -- 2.47.3