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

Commit e5e42b74 authored by Archie Pusaka's avatar Archie Pusaka
Browse files

floss: hcidoc: Remove associated CID when L2CAP is disconnected

It's a good bookkeeping practice to mark CID as unassigned when L2CAP
is disconnected. Furthermore, there could be a race from both sides of
the connection to disconnect the same CIDs. If we free those CIDs on
the first response, we won't process duplicate disconnection reports.

Bug: 293397988
Test: m -j
Flag: EXEMPT floss only changes
Change-Id: If0de7b21ffc8d998753077042bed0073e7e59df7
parent b2d30d48
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -324,7 +324,7 @@ impl AclInformation {
        _initiator: InitiatorType,
        ts: NaiveDateTime,
    ) {
        let host_cid_state_option = self.host_cids.get(&host_cid);
        let host_cid_state_option = self.host_cids.remove(&host_cid);
        let host_psm = match host_cid_state_option {
            Some(cid_state) => match cid_state {
                // TODO: assert that the peer cids match.
@@ -334,7 +334,7 @@ impl AclInformation {
            None => None,
        };

        let peer_cid_state_option = self.peer_cids.get(&peer_cid);
        let peer_cid_state_option = self.peer_cids.remove(&peer_cid);
        let peer_psm = match peer_cid_state_option {
            Some(cid_state) => match cid_state {
                // TODO: assert that the host cids match.
@@ -351,7 +351,7 @@ impl AclInformation {
            );
        }
        let psm = match host_psm.or(peer_psm) {
            Some(psm) => *psm,
            Some(psm) => psm,
            None => return, // No recorded PSM, no need to report.
        };