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

fix(macos): Break the corebluetooth loop when manager turned off #388

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

dmtrKovalenko
Copy link

@dmtrKovalenko dmtrKovalenko commented May 24, 2024

closes #387

In Core Bluetooth when the device is locked or suspended and it is not applicable for background Bluetooth access the manager will create an event for state change and after will change the manager state to powerOff. Currently, it is not tracked at all which
leads to the forever stuck unresolved futures while the connection to peripheral is still held.

An additional problem I faced that there is no way to manually kill the
event loop of the corebluetooth from outside so the
CoreBluetoothInternal::drop is never called because it is always
living in the stalled thread.

In this change, I added an API to access the manager state and exited
the event loop when if the manager turned off.

@dmtrKovalenko dmtrKovalenko force-pushed the fix/core-bluetooth-stuck-forevert branch 2 times, most recently from 6eab2c5 to 60d00ca Compare May 24, 2024 11:22
@qwandor qwandor changed the base branch from master to dev May 24, 2024 11:22
closes deviceplug#387

In Core Bluetooth when the device is not applicable for background
bluetooth manager will create an event for state change. And then change
the manager state to power off. Currently, it is not tracked at all which
leads to the forever stuck unresolved issues while the connection to
peripheral is still held.

An additional problem I faced that there is no way to manually kill the
event loop of the corebluetooth from outside so the
`CoreBluetoothInternal::drop` is never called because it is always
living in the stalled thread.

In this change, I added an API to access the manager state and exited
the event loop when if the manager turned off.
@dmtrKovalenko dmtrKovalenko force-pushed the fix/core-bluetooth-stuck-forevert branch from 60d00ca to a0635d7 Compare May 24, 2024 11:31
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

Successfully merging this pull request may close these issues.

2 participants