Skip to content

Commit

Permalink
Do not retry l2cap_cbm_create_channel on failure
Browse files Browse the repository at this point in the history
  • Loading branch information
shermp committed Sep 24, 2024
1 parent 8a150e0 commit 18c406b
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions src/hearing_aid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,7 @@ void HA::subscribe_to_asp_notification()
void HA::create_l2cap_channel()
{
state = State::L2Connecting;
int cx_attempts = 0;
uint8_t res = ERROR_CODE_SUCCESS;
do {
LOG_INFO("%s: Connecting to L2CAP", side_str);
res = l2cap_cbm_create_channel(l2cap_packet_handler,
conn_handle,
Expand All @@ -89,14 +87,9 @@ void HA::create_l2cap_channel()
&cid);
if (res != ERROR_CODE_SUCCESS) {
LOG_ERROR("%s: Failure creating l2cap channel with error code: 0x%02x", side_str, (unsigned int)res);
++cx_attempts;
}
} while (res != ERROR_CODE_SUCCESS && cx_attempts < 5);
if (res != ERROR_CODE_SUCCESS) {
state = State::GATTDisconnect;
gap_disconnect(conn_handle);
}

}

void HA::on_l2cap_channel_created(uint8_t status)
Expand Down

0 comments on commit 18c406b

Please sign in to comment.