Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Client design makes it too easy to leak bluetooth notify callbacks on disconnect #667

Open
bdraco opened this issue Nov 23, 2023 · 2 comments
Assignees

Comments

@bdraco
Copy link
Member

bdraco commented Nov 23, 2023

The current design of bluetooth_gatt_start_notify returns two callables:

  • One that the caller must call when the device disconnects
  • One that the caller must call to unsubscribe from a notification

We should only return one callable and handle cleaning up disconnecting the callback in _on_bluetooth_device_connection_response so callers can't get it wrong and leak a callback

@bdraco bdraco self-assigned this Nov 23, 2023
@bdraco
Copy link
Member Author

bdraco commented Nov 23, 2023

I think there is also a bug were we can miss a notify because we do not set up the listener before we subscribe so if the device replies with a notify right away we drop it

@bdraco
Copy link
Member Author

bdraco commented Nov 23, 2023

I need to fix the bug first before refactoring since we need a patch release for that. The refactoring to return a single callable would be a breaking change which requires a major version bump

@bdraco bdraco changed the title Client design makes it too easy leaks bluetooth notify callbacks on disconnect Client design makes it too easy to leak bluetooth notify callbacks on disconnect Nov 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant