-
Notifications
You must be signed in to change notification settings - Fork 306
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
backends/bluezdbus/manager: Cancel the discovery on disconnect to avoid a timeout #1092
backends/bluezdbus/manager: Cancel the discovery on disconnect to avoid a timeout #1092
Conversation
I agree this should be fixed, but I would like to suggest a different way of doing it. Instead of introducing a new class, we should be able to use |
Oh, thank you for highlighting this function, I only knew I tried to make something prettier than accessing directly |
7d650a2
to
5efc2f4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good start. However, _wait_condition
is a generic function, so we should leave it that way.
The asyncio.wait()
logic looks right, but it should replace await self._wait_condition(device_path, "ServicesResolved", True)
in get_services()
. And the two tasks can be defined at self._wait_condition(device_path, "ServicesResolved", True)
and self._wait_condition(device_path, "Connected", False)
.
Right! I was so focused on my services discovery issue that I completely skipped the fact that this method is for any property change. |
5efc2f4
to
d128393
Compare
…id a timeout If a device disconnects while waiting for the services to be discovered, the manager will wait forever. This commit fixes that by throwing an exception in case of a disconnect.
d128393
to
0470364
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks!
…service discovery and bluez related hbldh/bleak#1092
If a device disconnects while waiting for the services to be discovered, the manager will wait forever.
This commit fixes that by introducing a context to the _wait_condition method with an exception on disconnect.