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

Commit fe33c3d0 authored by Pomai Ahlo's avatar Pomai Ahlo Committed by Gerrit Code Review
Browse files

Merge "Log when a function returns BT_STATUS_NOT_READY" into main

parents ac7ca370 0b1d7737
Loading
Loading
Loading
Loading
+14 −3
Original line number Diff line number Diff line
@@ -139,6 +139,8 @@ void btsock_rfc_cleanup(void) {
  }

  uid_set = NULL;

  LOG_DEBUG("cleanup finished");
}

static rfc_slot_t* find_free_slot(void) {
@@ -294,7 +296,10 @@ bt_status_t btsock_rfc_listen(const char* service_name,
  // error to call
  // functions on RFCOMM sockets before initializing the module. Probably
  // should be an assert.
  if (!is_init_done()) return BT_STATUS_NOT_READY;
  if (!is_init_done()) {
    LOG_ERROR("BT not ready");
    return BT_STATUS_NOT_READY;
  }

  if ((flags & BTSOCK_FLAG_NO_SDP) == 0) {
    if (!service_uuid || service_uuid->IsEmpty()) {
@@ -349,7 +354,10 @@ bt_status_t btsock_rfc_connect(const RawAddress* bd_addr,
  // error to call
  // functions on RFCOMM sockets before initializing the module. Probably should
  // be an assert.
  if (!is_init_done()) return BT_STATUS_NOT_READY;
  if (!is_init_done()) {
    LOG_ERROR("BT not ready");
    return BT_STATUS_NOT_READY;
  }

  std::unique_lock<std::recursive_mutex> lock(slot_lock);

@@ -1037,7 +1045,10 @@ int bta_co_rfc_data_outgoing(uint32_t id, uint8_t* buf, uint16_t size) {

bt_status_t btsock_rfc_disconnect(const RawAddress* bd_addr) {
  CHECK(bd_addr != NULL);
  if (!is_init_done()) return BT_STATUS_NOT_READY;
  if (!is_init_done()) {
    LOG_ERROR("BT not ready");
    return BT_STATUS_NOT_READY;
  }

  std::unique_lock<std::recursive_mutex> lock(slot_lock);
  for (size_t i = 0; i < ARRAY_SIZE(rfc_slots); ++i) {