shared/gatt-client: Fix handling of service changed
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Fri, 17 Jul 2020 19:08:14 +0000 (12:08 -0700)
committerAyush Garg <ayush.garg@samsung.com>
Mon, 12 Apr 2021 09:00:49 +0000 (14:30 +0530)
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.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
src/shared/gatt-client.c

index aaab9e3a7c4fa3392496039ee4bfff52f820aa53..5843ff2c0d63af8889e59c03ab08d6e306ee5253 100644 (file)
@@ -1603,8 +1603,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);