-
Notifications
You must be signed in to change notification settings - Fork 998
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
transports/tcp: Update if-watch to v3.0.0
#3101
Conversation
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.
} | ||
|
||
fn addrs(if_watcher: &Self::IfWatcher) -> Vec<if_watch::IpNet> { | ||
if_watcher.iter().copied().collect() |
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.
Returning the iterator would be possible using a HRTB, but given that this is only called in a rare error path I opted for the simpler approach.
tokio = ["tokio-crate"] | ||
async-io = ["async-io-crate"] | ||
tokio = ["dep:tokio", "if-watch/tokio"] | ||
async-io = ["dep:async-io", "if-watch/smol"] |
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.
switching to dep:tokio
style as was done in other crates — let me know if this one was deliberately left unchanged
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.
LGTM Roland!
Co-authored-by: João Oliveira <[email protected]>
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.
One idea, otherwise LGTM!
@@ -46,6 +48,14 @@ pub trait Provider: Clone + Send + 'static { | |||
type Stream: AsyncRead + AsyncWrite + Send + Unpin + fmt::Debug; | |||
/// The type of TCP listeners obtained from [`Provider::new_listener`]. | |||
type Listener: Send + Unpin; | |||
/// The type of IfWatcher obtained from [`Provider::new_if_watcher`]. | |||
type IfWatcher: Stream<Item = io::Result<IfEvent>> + Send + Unpin; |
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.
type IfWatcher: Stream<Item = io::Result<IfEvent>> + Send + Unpin; | |
type IfWatcher: Stream<Item = io::Result<IfEvent>> + IntoIterator<Item = IpNet> + Send + Unpin; |
Is this legal Rust? My brain compiler is unsure but it could avoid the need for the addrs
function I think.
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.
It is legal syntax, but neither IfWatcher implementation implements this trait, plus into_iter
consumes self
, so we wouldn’t be able to use this here.
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.
Ah damn!
The naming of iter
suggested that we actually implement the Iterator
trait but I guess the consuming nature of IntoIterator
makes this unworkable anyway.
Thanks for checking!
v3.0.0
anything still needed from my side to merge this? |
No. For some reason mergify doesn't like this PR. I'll have to look into that. |
I also can't update the branch manually. Getting the same error as shown in the mergify check. |
@rkuhn Can you push a merge-commit with master manually? |
all done :-) |
Description
Update to
if-watch
version 3.0.0 and pass through features, such thatlibp2p-tcp/async-io
selectsif-watch/smol
andlibp2p-tcp/tokio
brings inif-watch/tokio
.The mDNS part is already done in #3096.
Links to any relevant issues
supersedes #3095
Open Questions
Change checklist
Commit message body
Release 3.0.0 introduces executor-specific features which we now activate accordingly.