From b1bb02c964876edb1a79b1679930aa628a82b62a Mon Sep 17 00:00:00 2001 From: "matthias.ringwald" Date: Wed, 27 Aug 2014 12:52:20 +0000 Subject: [PATCH] move check for acl packets after state machines for CMAC, key generation, random address generation --- ble/sm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ble/sm.c b/ble/sm.c index eaf1f484d..f9e9e869b 100644 --- a/ble/sm.c +++ b/ble/sm.c @@ -855,9 +855,8 @@ static void sm_pdu_received_in_wrong_state(){ static void sm_run(void){ - // assert that we can send either one + // assert that we can send at least commands if (!hci_can_send_command_packet_now()) return; - if (!l2cap_can_send_fixed_channel_packet_now(connection->sm_handle)) return; sm_key_t plaintext; @@ -977,6 +976,9 @@ static void sm_run(void){ break; } + // assert that we could send a SM PDU - not needed for all of the following + if (!l2cap_can_send_fixed_channel_packet_now(connection->sm_handle)) return; + // responding state switch (connection->sm_engine_state){