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

Commit f872d5f4 authored by Łukasz Rymanowski's avatar Łukasz Rymanowski
Browse files

gatt: Fix infinite loop on ACL disconnect

Fix obvious mistake.
Error can be visible if multiple BLE devices is in used, some of the
GATT commands are queued and then first disconnected device has no queue
GATT commands.

Bug: 257046947
Test: manual
 - Connect BLE devices X, Y
 - Queue multiple commands on device X
 - Disconnect device Y

Tag: #feature
Merged-In: Ic0877bf7322dfa5bf0103bb6eab18cadac51244b
Change-Id: Ic0877bf7322dfa5bf0103bb6eab18cadac51244b
parent 262901f8
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -1631,7 +1631,10 @@ void gatt_cleanup_upon_disc(const RawAddress& bda, tGATT_DISCONN_REASON reason,

  for (auto clcb_it = gatt_cb.clcb_queue.begin();
       clcb_it != gatt_cb.clcb_queue.end();) {
    if (clcb_it->p_tcb != p_tcb) continue;
    if (clcb_it->p_tcb != p_tcb) {
      ++clcb_it;
      continue;
    }

    gatt_stop_rsp_timer(&(*clcb_it));
    VLOG(1) << "found p_clcb conn_id=" << +clcb_it->conn_id;