Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Added connection Handle check before gap event is handled in characteristic to fix the deadlock issue in #151 #171

Merged
merged 2 commits into from
Feb 12, 2025

Conversation

vermasrijan19
Copy link
Contributor

The handle_gap_event that lead to deadlocks where an invalid connection handle 65535 would occur after a failed notify ( no clue what caused that to occur).
The connection handle value was 65535(highest value for u16) which is an invalid conn_handle (unless someone somehow managed to connect that many devices).

The try_lock() worked as a stop gap but it would lead to failed read/write attempts when notify was in progress which would lead to disconnection.

… lead to deadlocks where an invalid connection handle 65535 would occur after a failed notify ( no clue what caused that to occur)
@taks
Copy link
Owner

taks commented Feb 12, 2025

Thanks @vermasrijan19 .
Colud you change to use early return as follows.

if crate::utilities::ble_gap_conn_find(conn_handle).is_err() {
  ::log::warn!("the conn handle does not exist");
  return sys::BLE_ATT_ERR_UNLIKELY as _;
}

@taks taks merged commit e2aaa24 into taks:main Feb 12, 2025
0 of 9 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants