-
Notifications
You must be signed in to change notification settings - Fork 617
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
Discovery: Refactor and add Avahi DBus backend #1347
Conversation
ae578f5
to
e49dde6
Compare
Tests seem to pass now (I've had to bump MSRV and improve handling of the feature flags). The one remaining test failure seems to be spurious: It's a timeout when testing EDIT: Re-based and cleaned up commit history. |
561fada
to
862e73e
Compare
Hi,
|
I've build this branch successfully using When I don't specify any 'zeroconf' backend (e.g. |
Sorry, I have fixed that locally already and forgot to push it. Will do so later today! |
99e5ed4
to
33964da
Compare
Build should be fixed now for any feature combination :) |
Building with only
|
012dac9
to
c6873ba
Compare
Oh, right: I didn't think about that case. Previously, there was no way to compile librespot without discovery/zeroconf support, but this is a possibility now. (And I guess it's sensible: If people want to build a minimal-size executable, and require only OAuth support, they could compile without zeroconf backend.) Should be fixed now, with librespot exiting with an error message if the combination of compile-time features and CLI options leaves no way to authenticate. |
Works now.
|
d07063f
to
2579003
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.
I think this is awesome! Please note that I'm the process of releasing 0.5.0 as we speak, so please move your changelog entries into a post-0.5.0 "Unreleased" section that should be there momentarily.
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.
Thanks for the review 👍 I left some comments inline, and will push an update in a minute.
828ce4c
to
3d28d93
Compare
If you could resolve that last comment, and resolve the conflicts, I'm all for merging this. 👍 |
You think you could do something about #1379 here? |
Will do!
The new backend should not be affected by that issue, cf. my comment at #1379. I think there's room to improve documentation around that issue, and maybe also to improve librespot defaults. However, I think that's out of scope here. |
3d28d93
to
878d64d
Compare
878d64d
to
63a9579
Compare
Thanks for the update. I think there's something up with the changelog merge. Could you move your changes up to the "Unreleased" section? Also probably should mark the
Props for the extensive reply there. All good to me. I thought maybe it was easy to slip that proposal in here, but totally fine to keep that for some other PR. |
63a9579
to
c8a00b9
Compare
This helps to decouple discovery and core by not leaking implementation details of the zeroconf backend into Error conversion impls in core.
previously, libmdns errors would use a generic conversion from std::io::Error to core::Error
in preparation for adding another backend: The only purpose of this is to unregister the service on drop. Thus, it is much easier to work with an opaque type, which avoids proliferation #[cfg(...)] gates.
in preparation for re-working feature flags and adding another backend
i.e. add with-libmdns instead of using not(with-dns-sd). This is in preparation for adding another backend, and in general recommended, cf. https://doc.rust-lang.org/cargo/reference/features.html#mutually-exclusive-features The logic is such that enabling with-dns-sd in addition to the default with-libmdns will still end up using dns-sd, as before. If only with-libmdns is enabled, that will be the default. If none of the features is enabled, attempting to build a `Discovery` will yield an error.
required by zbus >= 4
Previously, on drop the the shutdown_tx/close_tx, it wasn't guaranteed the corresponding tasks would continue to be polled until they actually completed their shutdown. Since dns_sd::Service is not Send and non-async, and because libmdns is non-async, put them on their own threads.
This deals gracefully with the case where the Avahi daemon is restarted or not running initially.
...but exit with an error if there's no way to authenticate
c8a00b9
to
e6645f1
Compare
Completely missed this when rebasing, thanks for the heads-up! Hopefully, this should be fixed now.
👍 |
Merged, thanks a lot! May I ask you to also update the wiki with the new command line options? With these breaking changes, we're going to up the version to 0.6.0. And hey, since faster releases are requested, would what we have now not be a nice scope? |
Done! |
Is there a summary somewhere as to which library to use under which circumstances? What are the pros and cons of them? (I'm not familiar with mDNS here, but providing a librespot based binary to many platforms... Windows, Mac, Linux) |
So... I was mildly annoyed by the
warnings from the
dns_sd
compat library and thought it would be a fun little project to write an additional MDNS/DNS-SD backend that directly talks to Avahi via DBus.This PR is a minimal working example of that. I made quite some refactorings to the discovery module in order to keep the code readable and not litter it too much with
#[cfg(feature = "with-xyz")]
guards. This should be fairly easy to review by looking at the individual commits and their messages.I have a local branch with some more error handling in the
avahi_task
, but I'd be happy about your opinion on this before making things more complicated (I'd also need to clean that up a bit).Does this have a place in librespot upstream? If so, I'd add some more documentation around the new feature flags and commandline flag.