Bluetooth: test: Delay SMP pairing distribution phase when testing

Avoid the HCI-USB race condition where HCI data and HCI events can be
re-ordered, and pairing information appears to be sent unencrypted.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
This commit is contained in:
Joakim Andersson 2020-02-20 18:01:56 +01:00 committed by Johan Hedberg
commit 9ab17a3eb4

View file

@ -4356,6 +4356,14 @@ static void bt_smp_encrypt_change(struct bt_l2cap_chan *chan,
return;
}
if (IS_ENABLED(CONFIG_BT_TESTING)) {
/* Avoid the HCI-USB race condition where HCI data and
* HCI events can be re-ordered, and pairing information appears
* to be sent unencrypted.
*/
k_sleep(K_MSEC(100));
}
if (bt_smp_distribute_keys(smp)) {
return;
}