Bluetooth: GATT: Fix calling read handler twice
If length is already 0 there is no point in calling the handler again as that already mark the end of the operation. Change-Id: I212a6d8bdd9aa3d9886099bb7ed3f9d3831bcf1a Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
parent
07c8be1791
commit
237455f77f
|
@ -1355,6 +1355,11 @@ static void att_read_rsp(struct bt_conn *conn, uint8_t err, const void *pdu,
|
|||
return;
|
||||
}
|
||||
|
||||
/* Stop if no data left */
|
||||
if (!length) {
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Core Spec 4.2, Vol. 3, Part G, 4.8.1
|
||||
* If the Characteristic Value is greater than (ATT_MTU - 1) octets
|
||||
|
@ -1410,6 +1415,10 @@ static void att_read_multiple_rsp(struct bt_conn *conn, uint8_t err,
|
|||
|
||||
params->func(conn, 0, params, pdu, length);
|
||||
|
||||
if (!length) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* mark read as complete since read multiple is single response */
|
||||
params->func(conn, 0, params, NULL, 0);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue