shared/gatt-client: Fix not sending confirmations
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Mon, 28 Aug 2023 17:53:55 +0000 (10:53 -0700)
committerAyush Garg <ayush.garg@samsung.com>
Fri, 5 Jan 2024 13:34:03 +0000 (19:04 +0530)
Commit fde32ff9c9c0 ("shared/gatt-client: Allow registering with NULL
callback") added an early return to the notify_cb function when the
current client's notify_list is empty which prevents sending
confirmations to indications.

Reported-by: Javier de San Pedro <dev.git@javispedro.com>
src/shared/gatt-client.c

index 73f762b1ab870582bcde1da5f887802132660437..309f4dc5667b7c12ed585365f5198a74dd4fedda 100644 (file)
@@ -2547,11 +2547,11 @@ static void notify_cb(struct bt_att_chan *chan, uint8_t opcode,
        }
 #endif
 
-       if (queue_isempty(client->notify_list))
-               return;
-
        bt_gatt_client_ref(client);
 
+       if (queue_isempty(client->notify_list))
+               goto done;
+
        memset(&data, 0, sizeof(data));
 
        if (opcode == BT_ATT_OP_HANDLE_NFY_MULT) {
@@ -2585,6 +2585,7 @@ static void notify_cb(struct bt_att_chan *chan, uint8_t opcode,
                queue_foreach(client->notify_list, notify_handler, &data);
        }
 
+done:
        if (opcode == BT_ATT_OP_HANDLE_IND && !client->parent){
 #ifdef TIZEN_FEATURE_BLUEZ_MODIFY
        if (!chan)