device: Fix not setting initiator

This fixes not setting initiator flag properly when MGMT connect event
has not been processed yet but ATT is already connected or is in
progress.
This commit is contained in:
Luiz Augusto von Dentz 2022-08-24 14:23:25 -07:00
parent 4760ada065
commit 73b301372b

View File

@ -301,7 +301,7 @@ static bool get_initiator(struct btd_device *dev)
if (dev->bredr_state.connected)
return dev->bredr_state.initiator;
return false;
return dev->att_io ? true : false;
}
static GSList *find_service_with_profile(GSList *list, struct btd_profile *p)
@ -5368,6 +5368,9 @@ static void att_connect_cb(GIOChannel *io, GError *gerr, gpointer user_data)
goto done;
}
/* Update connected state */
device->le_state.connected = true;
if (!device_attach_att(device, io))
goto done;