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

Commit c0fcaf9f authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "BluetoothMetrics: LE Connection Metrics: Moving the mutex up due to race condition"

parents 3163833c 39da2fb8
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -169,6 +169,8 @@ void LEConnectionMetricsRemoteDevice::AddStateChangedEvent(
        common::ToHexString(transaction_state).c_str(),
        common::ToHexString(connection_type).c_str(),
        common::ToHexString(origin_type).c_str());

  std::unique_lock<std::mutex> lock(le_connection_metrics_remote_device_guard);
  if (address.IsEmpty()) {
    LOG_INFO(
        "LEConnectionMetricsRemoteDevice: Empty Address Cancellation %s, %s, %s\n",
@@ -197,7 +199,6 @@ void LEConnectionMetricsRemoteDevice::AddStateChangedEvent(
    return;
  }

  std::unique_lock<std::mutex> lock(le_connection_metrics_remote_device_guard);
  auto it = opened_devices.find(address);
  if (it == opened_devices.end()) {
    device_metrics.push_back(std::make_unique<LEConnectionMetricState>(address));