Skip to content

Commit

Permalink
shared/gatt-client: Fix not sending confirmations
Browse files Browse the repository at this point in the history
Commit fde32ff ("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>
  • Loading branch information
Vudentz committed Aug 28, 2023
1 parent 6a8f7c5 commit 670f0d0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/shared/gatt-client.c
Original file line number Diff line number Diff line change
Expand Up @@ -2232,11 +2232,11 @@ static void notify_cb(struct bt_att_chan *chan, uint8_t opcode,
struct bt_gatt_client *client = user_data;
struct value_data data;

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) {
Expand Down Expand Up @@ -2271,6 +2271,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)
bt_att_chan_send(chan, BT_ATT_OP_HANDLE_CONF, NULL, 0,
NULL, NULL, NULL);
Expand Down

1 comment on commit 670f0d0

@lilandrias
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solves issue #594 for me.

Please sign in to comment.