-
Notifications
You must be signed in to change notification settings - Fork 874
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
misc/mdns: Make MdnsService::new sync by using std::net::UdpSocket::bind #1382
Conversation
MdnsService uses an IP address to create a UDP socket. The address does not need to be resolved. Therefore one can use std's UdpSocket::bind instead of the async counterpart from async-std. As a result MdnsService::new and MdnsService::silent don't need to be async.
misc/mdns/src/behaviour.rs
Outdated
@@ -90,7 +90,7 @@ impl<TSubstream> Mdns<TSubstream> { | |||
/// Builds a new `Mdns` behaviour. | |||
pub async fn new() -> io::Result<Mdns<TSubstream>> { |
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.
pub async fn new() -> io::Result<Mdns<TSubstream>> { | |
pub fn new() -> io::Result<Mdns<TSubstream>> { |
?
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.
Right. That makes a lot of sense. Thanks.
Looks good to me, other than @twittner's correction. |
Should we merge this after we released |
We've already got a few breaking changes in, so let's go ahead with that. |
MdnsService uses an IP address to create a UDP socket. The address does
not need to be resolved. Therefore one can use std's UdpSocket::bind
instead of the async counterpart from async-std. As a result
MdnsService::new and MdnsService::silent don't need to be async.
#1328 (comment)
(//CC @demimarie-parity)