-
Notifications
You must be signed in to change notification settings - Fork 938
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
protocols/mdns: Support multiple network interfaces #2383
Conversation
2ec9d55
to
39e3ee8
Compare
ping @mxinden do you have some time to review? Think it's pretty reliable now. |
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.
Listening and sending via multiple interfaces sounds good to me. Split into InterfaceState
makes sense to me.
I will need a bit more time to give this an in-depth review.
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.
Couple of comments and missing a changelog entry. Looks good to me otherwise. Thank you for the contribution.
protocols/mdns/src/iface.rs
Outdated
@@ -0,0 +1,238 @@ | |||
// Copyright 2018 Parity Technologies (UK) Ltd. |
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.
Should this file not rather live in src/behaviour/iface.rs
? It is only used within src/behaviour.rs
, right?
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.
not sure how adding more directories for a small crate helps. is there some "policy" for the rust-libp2p repo somewhere?
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 am following the convention: If module B is used in module A only, move it into a/b.rs
. I think we are doing a decent job following this convention.
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.
well, I don't like large nested repos. some directories make sense sometimes when organizing files, but if a crate has 4 files, I don't think it's helpful. Made the change (still open to reverting if you change your mind)
b454fdf
to
24ae235
Compare
Mind running a final |
24ae235
to
b711a68
Compare
Handling multiple interfaces in mdns. The socket logic was moved into an instance while the mdns behaviour watches for interface changes and creates new instances with a dedicated send/recv socket. Co-authored-by: Max Inden <mail@max-inden.de>
so had some issues with mdns between my laptop and my phone when android was acting as a hotspot. this is due to binding to 0.0.0.0 which selects the iface with internet connectivity leading to failure for the devices to detect each other. this fixes that by properly handling multiple interfaces in mdns. the socket logic was moved into an instance while the mdns behaviour watches for interface changes and creates new instances with a dedicated send/recv socket.