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

Commit fd6dc571 authored by Myles Watson's avatar Myles Watson
Browse files

HciSocketDevice: Only call close_callback once

Bug: 154020729
Test: cert/run --host
Tag: #compatibility
Change-Id: Ia42dba6a06bdf5d41e998e2fd48f95f289e88edc
parent 7aa0f9a2
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -88,8 +88,8 @@ HciSocketDevice::HciSocketDevice(int file_descriptor) : socket_file_descriptor_(
      },
      [this]() {
        LOG_INFO("HCI socket device disconnected");
        close_callback_();
        socket_file_descriptor_ = -1;
        close_callback_();
      });

  RegisterEventChannel([this](std::shared_ptr<std::vector<uint8_t>> packet) {
@@ -123,7 +123,9 @@ void HciSocketDevice::SendHci(hci::PacketType packet_type, const std::shared_ptr
}

void HciSocketDevice::RegisterCloseCallback(std::function<void()> close_callback) {
  if (socket_file_descriptor_ != -1) {
    close_callback_ = close_callback;
  }
}

}  // namespace test_vendor_lib