Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4a172fac authored by Jakub Pawlowski's avatar Jakub Pawlowski
Browse files

Do not crash on LE Create Connection "Command Disallowed"

Being in "Connecting" used to mean we are either doing direct
connection, or background connection procedure. Now we have just one
connection procedure. This means there is no ambiguity when the
controller responds with "Command Disallowed" - we know exactly which
state to go back to.

Bug: 110412113
Bug: 112827989
Test: there is no test, or reproduction scenarion to verify that
      Ran GattConnectTest for sanity

Change-Id: I9ed1cdc7ae4032cda4e8a166310eca0004c7f9dc
parent abeb161e
Loading
Loading
Loading
Loading
+5 −8
Original line number Original line Diff line number Diff line
@@ -85,18 +85,15 @@ void btm_send_hci_create_connection(
void btm_ble_create_ll_conn_complete(uint8_t status) {
void btm_ble_create_ll_conn_complete(uint8_t status) {
  if (status == HCI_SUCCESS) return;
  if (status == HCI_SUCCESS) return;


  btm_ble_set_conn_st(BLE_CONN_IDLE);
  btm_ble_update_mode_operation(HCI_ROLE_UNKNOWN, NULL, status);

  LOG(WARNING) << "LE Create Connection attempt failed, status="
  LOG(WARNING) << "LE Create Connection attempt failed, status="
               << loghex(status);
               << loghex(status);


  if (status == HCI_ERR_COMMAND_DISALLOWED) {
  if (status == HCI_ERR_COMMAND_DISALLOWED) {
    /* There is already either direct connect, or whitelist connection
    btm_ble_set_conn_st(BLE_CONNECTING);
     * pending, but we don't know which one, or to which state should we
    LOG(ERROR) << "LE Create Connection - command disallowed";
     * transition now. This can be triggered only in case of rare race
  } else {
     * condition. Crash to recover. */
    btm_ble_set_conn_st(BLE_CONN_IDLE);
    LOG(FATAL) << "LE Create Connection - command disallowed";
    btm_ble_update_mode_operation(HCI_ROLE_UNKNOWN, NULL, status);
  }
  }
}
}