Bluetooth: ATT: Fix handling ATT response
The callback function may modify the att->req and it has to be called after the att_process. The att_process does not re-check if att->req is still NULL. Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
This commit is contained in:
parent
11eb3b6c4f
commit
bce335458b
1 changed files with 4 additions and 3 deletions
|
@ -344,7 +344,7 @@ static void att_process(struct bt_att *att)
|
|||
|
||||
static u8_t att_handle_rsp(struct bt_att *att, void *pdu, u16_t len, u8_t err)
|
||||
{
|
||||
bt_att_func_t func;
|
||||
bt_att_func_t func = NULL;
|
||||
void *params;
|
||||
|
||||
BT_DBG("err 0x%02x len %u: %s", err, len, bt_hex(pdu, len));
|
||||
|
@ -378,11 +378,12 @@ static u8_t att_handle_rsp(struct bt_att *att, void *pdu, u16_t len, u8_t err)
|
|||
att_req_destroy(att->req);
|
||||
att->req = NULL;
|
||||
|
||||
func(att->chan.chan.conn, err, pdu, len, params);
|
||||
|
||||
process:
|
||||
/* Process pending requests */
|
||||
att_process(att);
|
||||
if (func) {
|
||||
func(att->chan.chan.conn, err, pdu, len, params);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue