From 3bb5ff27f3d47c809395c97731c4b72ac61d813e Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Thu, 2 Dec 2021 19:58:56 +0100 Subject: [PATCH] hci: avoid discard ACL connections on connection complete with error for SCO to same peer --- src/hci.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/hci.c b/src/hci.c index 6f0e6c8d0..b9b2448a6 100644 --- a/src/hci.c +++ b/src/hci.c @@ -2042,6 +2042,11 @@ static void hci_initializing_event_handler(const uint8_t * packet, uint16_t size } static void hci_handle_connection_failed(hci_connection_t * conn, uint8_t status){ + // CC2564C might emit Connection Complete for rejected incoming SCO connection + // To prevent accidentally free'ing the CHI connection for the ACL connection, + // check if the hci connection has been outgoing + if (conn->state != SENT_CREATE_CONNECTION) return; + log_info("Outgoing connection to %s failed", bd_addr_to_str(conn->address)); bd_addr_t bd_address; (void)memcpy(&bd_address, conn->address, 6);