Bluetooth: GATT: Fix error response in Find by Type response

We shouldn't respond with an error if the read of UUID failed.
It's because we don't know if this UUID was the one that client
requested in the Find by Type Value request.

Change-Id: I34c336b9afc3520194fbddaaee8a44d51beabad5
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
This commit is contained in:
Mariusz Skamra 2016-01-14 15:03:47 +01:00 committed by Anas Nashif
commit 4b7124b637

View file

@ -406,8 +406,12 @@ static uint8_t find_type_cb(const struct bt_gatt_attr *attr, void *user_data)
/* Read attribute value and store in the buffer */
read = attr->read(conn, attr, uuid, sizeof(uuid), 0);
if (read < 0) {
/* TODO: Return an error if this fails */
return BT_GATT_ITER_STOP;
/*
* Since we don't know if it is the service with requested UUID,
* we cannot respond with an error to this request.
*/
data->group = NULL;
return BT_GATT_ITER_CONTINUE;
}
/* Check if data matches */