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

Commit de02738e authored by Krzysztof Kopyściński's avatar Krzysztof Kopyściński
Browse files

has_client.cc: fix profile disconnection cleanup

GATT cleanup must be performed on HAS Device before it is removed from
`devices_` list - in other case, GATT queue will not be cleared, and
in the future, if another HAS Device gets the same connection ID, it
will "inherit" pending items - and will be unable to post its own to
GATT queue.

Bug: 356799752
Flag: Exempt, feature not launched yet
Test: atest --host --no-bazel-mode bluetooth_has_test
Change-Id: Id3cdc41b276efa44eb4e15b01f226393fab71e2b
parent b3e0af71
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -225,6 +225,7 @@ public:

      auto conn_id = device->conn_id;
      auto is_connecting_actively = device->is_connecting_actively;
      DoDisconnectCleanUp(*device);
      devices_.erase(device);

      if (conn_id != GATT_INVALID_CONN_ID) {
+1 −0
Original line number Diff line number Diff line
@@ -1219,6 +1219,7 @@ TEST_F(HasClientTest, test_disconnect_connected) {
  TestConnect(test_address);

  EXPECT_CALL(*callbacks, OnConnectionState(ConnectionState::DISCONNECTED, test_address)).Times(1);
  EXPECT_CALL(gatt_queue, Clean(1)).Times(1);
  TestDisconnect(test_address, 1);
}