From 4ef324b240dfef5a4e442b42cf81f48fb34562ae Mon Sep 17 00:00:00 2001 From: Yassine Ferhane <105550481+gitToki@users.noreply.github.com> Date: Wed, 26 Mar 2025 10:20:32 +0100 Subject: [PATCH 1/8] deprecate async mdns --- protocols/mdns/Cargo.toml | 1 + protocols/mdns/src/behaviour.rs | 5 ++++- protocols/mdns/src/behaviour/socket.rs | 4 ++++ protocols/mdns/src/behaviour/timer.rs | 4 ++++ protocols/mdns/src/lib.rs | 4 ++++ 5 files changed, 17 insertions(+), 1 deletion(-) diff --git a/protocols/mdns/Cargo.toml b/protocols/mdns/Cargo.toml index dbf66abe61c..f1666dcd225 100644 --- a/protocols/mdns/Cargo.toml +++ b/protocols/mdns/Cargo.toml @@ -28,6 +28,7 @@ hickory-proto = { workspace = true, features = ["mdns"] } [features] tokio = ["dep:tokio", "if-watch/tokio"] async-io = ["dep:async-io", "dep:async-std", "if-watch/smol"] +# async-io feature is deprecated and will be removed in a future release [dev-dependencies] async-std = { version = "1.9.0", features = ["attributes"] } diff --git a/protocols/mdns/src/behaviour.rs b/protocols/mdns/src/behaviour.rs index 68e28cf3d63..1873287d00d 100644 --- a/protocols/mdns/src/behaviour.rs +++ b/protocols/mdns/src/behaviour.rs @@ -79,7 +79,10 @@ pub trait Abort { } /// The type of a [`Behaviour`] using the `async-io` implementation. -#[cfg(feature = "async-io")] +#[cfg(feature = "async-io")]#[deprecated( + since = "0.43.0", + note = "async_io has been discontinued. Please use the tokio feature instead." +)] pub mod async_io { use std::future::Future; diff --git a/protocols/mdns/src/behaviour/socket.rs b/protocols/mdns/src/behaviour/socket.rs index cf11450fb4b..419b359415e 100644 --- a/protocols/mdns/src/behaviour/socket.rs +++ b/protocols/mdns/src/behaviour/socket.rs @@ -51,6 +51,10 @@ pub trait AsyncSocket: Unpin + Send + 'static { } #[cfg(feature = "async-io")] +#[deprecated( + since = "0.47.0", + note = "async_io has been discontinued. Please use the tokio feature instead." +)] pub(crate) mod asio { use async_io::Async; use futures::FutureExt; diff --git a/protocols/mdns/src/behaviour/timer.rs b/protocols/mdns/src/behaviour/timer.rs index 5fdb1beffae..2b46cfbb81d 100644 --- a/protocols/mdns/src/behaviour/timer.rs +++ b/protocols/mdns/src/behaviour/timer.rs @@ -41,6 +41,10 @@ pub trait Builder: Send + Unpin + 'static { } #[cfg(feature = "async-io")] +#[deprecated( + since = "0.47.0", + note = "async_io has been discontinued. Please use the tokio feature instead." +)] pub(crate) mod asio { use std::{ pin::Pin, diff --git a/protocols/mdns/src/lib.rs b/protocols/mdns/src/lib.rs index a0086a0e2d5..0977892dd6c 100644 --- a/protocols/mdns/src/lib.rs +++ b/protocols/mdns/src/lib.rs @@ -41,6 +41,10 @@ use std::{ mod behaviour; #[cfg(feature = "async-io")] +#[deprecated( + since = "0.47.0", + note = "async_io has been discontinued. Please use the tokio feature instead." +)] pub use crate::behaviour::async_io; #[cfg(feature = "tokio")] pub use crate::behaviour::tokio; From 0136ff6ac4e4875fb181f4426b9d3453ac2c0706 Mon Sep 17 00:00:00 2001 From: Yassine Ferhane <105550481+gitToki@users.noreply.github.com> Date: Wed, 26 Mar 2025 10:37:15 +0100 Subject: [PATCH 2/8] update version --- protocols/mdns/src/behaviour.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocols/mdns/src/behaviour.rs b/protocols/mdns/src/behaviour.rs index 1873287d00d..6457e213a7b 100644 --- a/protocols/mdns/src/behaviour.rs +++ b/protocols/mdns/src/behaviour.rs @@ -80,7 +80,7 @@ pub trait Abort { /// The type of a [`Behaviour`] using the `async-io` implementation. #[cfg(feature = "async-io")]#[deprecated( - since = "0.43.0", + since = "0.47.0", note = "async_io has been discontinued. Please use the tokio feature instead." )] pub mod async_io { From 07c7c9b953b60cdfaaa666ec69552abc402f353d Mon Sep 17 00:00:00 2001 From: Toki <105550481+gitToki@users.noreply.github.com> Date: Wed, 26 Mar 2025 10:43:56 +0100 Subject: [PATCH 3/8] Update behaviour.rs --- protocols/mdns/src/behaviour.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocols/mdns/src/behaviour.rs b/protocols/mdns/src/behaviour.rs index 6457e213a7b..cd5911ac4d2 100644 --- a/protocols/mdns/src/behaviour.rs +++ b/protocols/mdns/src/behaviour.rs @@ -81,7 +81,7 @@ pub trait Abort { /// The type of a [`Behaviour`] using the `async-io` implementation. #[cfg(feature = "async-io")]#[deprecated( since = "0.47.0", - note = "async_io has been discontinued. Please use the tokio feature instead." + note = "async-io has been discontinued. Please use the tokio feature instead." )] pub mod async_io { use std::future::Future; From 7b318ba33b7cd27d0f0ebba0ebefe261c069ff4a Mon Sep 17 00:00:00 2001 From: Yassine Ferhane <105550481+gitToki@users.noreply.github.com> Date: Wed, 26 Mar 2025 10:46:06 +0100 Subject: [PATCH 4/8] _io to -io --- protocols/mdns/src/behaviour.rs | 2 +- protocols/mdns/src/behaviour/socket.rs | 2 +- protocols/mdns/src/behaviour/timer.rs | 2 +- protocols/mdns/src/lib.rs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/protocols/mdns/src/behaviour.rs b/protocols/mdns/src/behaviour.rs index 6457e213a7b..cd5911ac4d2 100644 --- a/protocols/mdns/src/behaviour.rs +++ b/protocols/mdns/src/behaviour.rs @@ -81,7 +81,7 @@ pub trait Abort { /// The type of a [`Behaviour`] using the `async-io` implementation. #[cfg(feature = "async-io")]#[deprecated( since = "0.47.0", - note = "async_io has been discontinued. Please use the tokio feature instead." + note = "async-io has been discontinued. Please use the tokio feature instead." )] pub mod async_io { use std::future::Future; diff --git a/protocols/mdns/src/behaviour/socket.rs b/protocols/mdns/src/behaviour/socket.rs index 419b359415e..4d126b61845 100644 --- a/protocols/mdns/src/behaviour/socket.rs +++ b/protocols/mdns/src/behaviour/socket.rs @@ -53,7 +53,7 @@ pub trait AsyncSocket: Unpin + Send + 'static { #[cfg(feature = "async-io")] #[deprecated( since = "0.47.0", - note = "async_io has been discontinued. Please use the tokio feature instead." + note = "async-io has been discontinued. Please use the tokio feature instead." )] pub(crate) mod asio { use async_io::Async; diff --git a/protocols/mdns/src/behaviour/timer.rs b/protocols/mdns/src/behaviour/timer.rs index 2b46cfbb81d..2522b3425bd 100644 --- a/protocols/mdns/src/behaviour/timer.rs +++ b/protocols/mdns/src/behaviour/timer.rs @@ -43,7 +43,7 @@ pub trait Builder: Send + Unpin + 'static { #[cfg(feature = "async-io")] #[deprecated( since = "0.47.0", - note = "async_io has been discontinued. Please use the tokio feature instead." + note = "async-io has been discontinued. Please use the tokio feature instead." )] pub(crate) mod asio { use std::{ diff --git a/protocols/mdns/src/lib.rs b/protocols/mdns/src/lib.rs index 0977892dd6c..94fba95b57e 100644 --- a/protocols/mdns/src/lib.rs +++ b/protocols/mdns/src/lib.rs @@ -43,7 +43,7 @@ mod behaviour; #[cfg(feature = "async-io")] #[deprecated( since = "0.47.0", - note = "async_io has been discontinued. Please use the tokio feature instead." + note = "async-io has been discontinued. Please use the tokio feature instead." )] pub use crate::behaviour::async_io; #[cfg(feature = "tokio")] From 7892992d2743ee9f2c7c77033f1d942b89e6f8ae Mon Sep 17 00:00:00 2001 From: Toki Date: Sun, 13 Apr 2025 22:26:33 +0200 Subject: [PATCH 5/8] update mdns crate --- protocols/mdns/Cargo.toml | 11 +- protocols/mdns/src/behaviour.rs | 41 ------ protocols/mdns/src/behaviour/timer.rs | 49 +------ protocols/mdns/src/lib.rs | 10 +- protocols/mdns/tests/use-async-std.rs | 176 -------------------------- 5 files changed, 6 insertions(+), 281 deletions(-) delete mode 100644 protocols/mdns/tests/use-async-std.rs diff --git a/protocols/mdns/Cargo.toml b/protocols/mdns/Cargo.toml index f1666dcd225..455fca25352 100644 --- a/protocols/mdns/Cargo.toml +++ b/protocols/mdns/Cargo.toml @@ -11,8 +11,6 @@ keywords = ["peer-to-peer", "libp2p", "networking"] categories = ["network-programming", "asynchronous"] [dependencies] -async-std = { version = "1.12.0", optional = true } -async-io = { version = "2.3.3", optional = true } futures = { workspace = true } if-watch = { workspace = true } libp2p-core = { workspace = true } @@ -27,19 +25,16 @@ hickory-proto = { workspace = true, features = ["mdns"] } [features] tokio = ["dep:tokio", "if-watch/tokio"] -async-io = ["dep:async-io", "dep:async-std", "if-watch/smol"] -# async-io feature is deprecated and will be removed in a future release [dev-dependencies] -async-std = { version = "1.9.0", features = ["attributes"] } -libp2p-swarm = { workspace = true, features = ["tokio", "async-std"] } +libp2p-swarm = { workspace = true, features = ["tokio"] } tokio = { workspace = true, features = ["macros", "rt", "rt-multi-thread", "time"] } libp2p-swarm-test = { path = "../../swarm-test" } tracing-subscriber = { workspace = true, features = ["env-filter"] } [[test]] -name = "use-async-std" -required-features = ["async-io"] +name = "use-tokio" +required-features = ["tokio"] [[test]] name = "use-tokio" diff --git a/protocols/mdns/src/behaviour.rs b/protocols/mdns/src/behaviour.rs index cd5911ac4d2..82af16fe1be 100644 --- a/protocols/mdns/src/behaviour.rs +++ b/protocols/mdns/src/behaviour.rs @@ -78,47 +78,6 @@ pub trait Abort { fn abort(self); } -/// The type of a [`Behaviour`] using the `async-io` implementation. -#[cfg(feature = "async-io")]#[deprecated( - since = "0.47.0", - note = "async-io has been discontinued. Please use the tokio feature instead." -)] -pub mod async_io { - use std::future::Future; - - use async_std::task::JoinHandle; - use if_watch::smol::IfWatcher; - - use super::Provider; - use crate::behaviour::{socket::asio::AsyncUdpSocket, timer::asio::AsyncTimer, Abort}; - - #[doc(hidden)] - pub enum AsyncIo {} - - impl Provider for AsyncIo { - type Socket = AsyncUdpSocket; - type Timer = AsyncTimer; - type Watcher = IfWatcher; - type TaskHandle = JoinHandle<()>; - - fn new_watcher() -> Result { - IfWatcher::new() - } - - fn spawn(task: impl Future + Send + 'static) -> JoinHandle<()> { - async_std::task::spawn(task) - } - } - - impl Abort for JoinHandle<()> { - fn abort(self) { - async_std::task::spawn(self.cancel()); - } - } - - pub type Behaviour = super::Behaviour; -} - /// The type of a [`Behaviour`] using the `tokio` implementation. #[cfg(feature = "tokio")] pub mod tokio { diff --git a/protocols/mdns/src/behaviour/timer.rs b/protocols/mdns/src/behaviour/timer.rs index 2522b3425bd..5c307f47b77 100644 --- a/protocols/mdns/src/behaviour/timer.rs +++ b/protocols/mdns/src/behaviour/timer.rs @@ -22,7 +22,7 @@ use std::time::{Duration, Instant}; /// Simple wrapper for the different type of timers #[derive(Debug)] -#[cfg(any(feature = "async-io", feature = "tokio"))] +#[cfg(any(feature = "tokio"))] pub struct Timer { inner: T, } @@ -40,53 +40,6 @@ pub trait Builder: Send + Unpin + 'static { fn interval_at(start: Instant, duration: Duration) -> Self; } -#[cfg(feature = "async-io")] -#[deprecated( - since = "0.47.0", - note = "async-io has been discontinued. Please use the tokio feature instead." -)] -pub(crate) mod asio { - use std::{ - pin::Pin, - task::{Context, Poll}, - }; - - use async_io::Timer as AsioTimer; - use futures::Stream; - - use super::*; - - /// Async Timer - pub(crate) type AsyncTimer = Timer; - impl Builder for AsyncTimer { - fn at(instant: Instant) -> Self { - Self { - inner: AsioTimer::at(instant), - } - } - - fn interval(duration: Duration) -> Self { - Self { - inner: AsioTimer::interval(duration), - } - } - - fn interval_at(start: Instant, duration: Duration) -> Self { - Self { - inner: AsioTimer::interval_at(start, duration), - } - } - } - - impl Stream for AsyncTimer { - type Item = Instant; - - fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { - Pin::new(&mut self.inner).poll_next(cx) - } - } -} - #[cfg(feature = "tokio")] pub(crate) mod tokio { use std::{ diff --git a/protocols/mdns/src/lib.rs b/protocols/mdns/src/lib.rs index 94fba95b57e..836a6b2426a 100644 --- a/protocols/mdns/src/lib.rs +++ b/protocols/mdns/src/lib.rs @@ -28,8 +28,8 @@ //! //! # Usage //! -//! This crate provides a `Mdns` and `TokioMdns`, depending on the enabled features, which -//! implements the `NetworkBehaviour` trait. This struct will automatically discover other +//! This crate provides `TokioMdns` +//! which implements the `NetworkBehaviour` trait. This struct will automatically discover other //! libp2p nodes on the local network. #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] @@ -40,12 +40,6 @@ use std::{ }; mod behaviour; -#[cfg(feature = "async-io")] -#[deprecated( - since = "0.47.0", - note = "async-io has been discontinued. Please use the tokio feature instead." -)] -pub use crate::behaviour::async_io; #[cfg(feature = "tokio")] pub use crate::behaviour::tokio; pub use crate::behaviour::{Behaviour, Event}; diff --git a/protocols/mdns/tests/use-async-std.rs b/protocols/mdns/tests/use-async-std.rs deleted file mode 100644 index df08b39af07..00000000000 --- a/protocols/mdns/tests/use-async-std.rs +++ /dev/null @@ -1,176 +0,0 @@ -// Copyright 2018 Parity Technologies (UK) Ltd. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the "Software"), -// to deal in the Software without restriction, including without limitation -// the rights to use, copy, modify, merge, publish, distribute, sublicense, -// and/or sell copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE.use futures::StreamExt; - -use std::time::Duration; - -use futures::future::Either; -use libp2p_mdns::{async_io::Behaviour, Config, Event}; -use libp2p_swarm::{Swarm, SwarmEvent}; -use libp2p_swarm_test::SwarmExt as _; -use tracing_subscriber::EnvFilter; - -#[async_std::test] -async fn test_discovery_async_std_ipv4() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); - - run_discovery_test(Config::default()).await -} - -#[async_std::test] -async fn test_discovery_async_std_ipv6() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); - - let config = Config { - enable_ipv6: true, - ..Default::default() - }; - run_discovery_test(config).await -} - -#[async_std::test] -async fn test_expired_async_std() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); - - let config = Config { - ttl: Duration::from_secs(1), - query_interval: Duration::from_secs(10), - ..Default::default() - }; - - let mut a = create_swarm(config.clone()).await; - let a_peer_id = *a.local_peer_id(); - - let mut b = create_swarm(config).await; - let b_peer_id = *b.local_peer_id(); - - loop { - match futures::future::select(a.next_behaviour_event(), b.next_behaviour_event()).await { - Either::Left((Event::Expired(peers), _)) => { - if peers.into_iter().any(|(p, _)| p == b_peer_id) { - return; - } - } - Either::Right((Event::Expired(peers), _)) => { - if peers.into_iter().any(|(p, _)| p == a_peer_id) { - return; - } - } - _ => {} - } - } -} - -#[async_std::test] -async fn test_no_expiration_on_close_async_std() { - let _ = tracing_subscriber::fmt() - .with_env_filter(EnvFilter::from_default_env()) - .try_init(); - let config = Config { - ttl: Duration::from_secs(120), - query_interval: Duration::from_secs(10), - ..Default::default() - }; - - let mut a = create_swarm(config.clone()).await; - - let b = create_swarm(config).await; - let b_peer_id = *b.local_peer_id(); - async_std::task::spawn(b.loop_on_next()); - - // 1. Connect via address from mDNS event - loop { - if let Event::Discovered(peers) = a.next_behaviour_event().await { - if let Some((_, addr)) = peers.into_iter().find(|(p, _)| p == &b_peer_id) { - a.dial_and_wait(addr).await; - break; - } - } - } - - // 2. Close connection - let _ = a.disconnect_peer_id(b_peer_id); - a.wait(|event| { - matches!(event, SwarmEvent::ConnectionClosed { peer_id, .. } if peer_id == b_peer_id) - .then_some(()) - }) - .await; - - // 3. Ensure we can still dial via `PeerId`. - a.dial(b_peer_id).unwrap(); - a.wait(|event| { - matches!(event, SwarmEvent::ConnectionEstablished { peer_id, .. } if peer_id == b_peer_id) - .then_some(()) - }) - .await; -} - -async fn run_discovery_test(config: Config) { - let mut a = create_swarm(config.clone()).await; - let a_peer_id = *a.local_peer_id(); - - let mut b = create_swarm(config).await; - let b_peer_id = *b.local_peer_id(); - - let mut discovered_a = false; - let mut discovered_b = false; - - while !discovered_a && !discovered_b { - match futures::future::select(a.next_behaviour_event(), b.next_behaviour_event()).await { - Either::Left((Event::Discovered(peers), _)) => { - if peers.into_iter().any(|(p, _)| p == b_peer_id) { - discovered_b = true; - } - } - Either::Right((Event::Discovered(peers), _)) => { - if peers.into_iter().any(|(p, _)| p == a_peer_id) { - discovered_a = true; - } - } - _ => {} - } - } -} - -async fn create_swarm(config: Config) -> Swarm { - let mut swarm = - Swarm::new_ephemeral(|key| Behaviour::new(config, key.public().to_peer_id()).unwrap()); - - // Manually listen on all interfaces because mDNS only works for non-loopback addresses. - let expected_listener_id = swarm - .listen_on("/ip4/0.0.0.0/tcp/0".parse().unwrap()) - .unwrap(); - - swarm - .wait(|e| match e { - SwarmEvent::NewListenAddr { listener_id, .. } => { - (listener_id == expected_listener_id).then_some(()) - } - _ => None, - }) - .await; - - swarm -} From 84c96eed0ccbbec5b7169e403a27bcb112a5be50 Mon Sep 17 00:00:00 2001 From: Toki Date: Sun, 13 Apr 2025 22:29:28 +0200 Subject: [PATCH 6/8] update dns crate --- protocols/mdns/src/behaviour/socket.rs | 47 -------------------------- 1 file changed, 47 deletions(-) diff --git a/protocols/mdns/src/behaviour/socket.rs b/protocols/mdns/src/behaviour/socket.rs index 4d126b61845..02624c2ad03 100644 --- a/protocols/mdns/src/behaviour/socket.rs +++ b/protocols/mdns/src/behaviour/socket.rs @@ -50,53 +50,6 @@ pub trait AsyncSocket: Unpin + Send + 'static { ) -> Poll>; } -#[cfg(feature = "async-io")] -#[deprecated( - since = "0.47.0", - note = "async-io has been discontinued. Please use the tokio feature instead." -)] -pub(crate) mod asio { - use async_io::Async; - use futures::FutureExt; - - use super::*; - - /// AsyncIo UdpSocket - pub(crate) type AsyncUdpSocket = Async; - impl AsyncSocket for AsyncUdpSocket { - fn from_std(socket: UdpSocket) -> std::io::Result { - Async::new(socket) - } - - fn poll_read( - &mut self, - cx: &mut Context, - buf: &mut [u8], - ) -> Poll> { - // Poll receive socket. - futures::ready!(self.poll_readable(cx))?; - match self.recv_from(buf).now_or_never() { - Some(data) => Poll::Ready(data), - None => Poll::Pending, - } - } - - fn poll_write( - &mut self, - cx: &mut Context, - packet: &[u8], - to: SocketAddr, - ) -> Poll> { - futures::ready!(self.poll_writable(cx))?; - match self.send_to(packet, to).now_or_never() { - Some(Ok(_)) => Poll::Ready(Ok(())), - Some(Err(err)) => Poll::Ready(Err(err)), - None => Poll::Pending, - } - } - } -} - #[cfg(feature = "tokio")] pub(crate) mod tokio { use ::tokio::{io::ReadBuf, net::UdpSocket as TkUdpSocket}; From 05e927837b58c84d68cf677662577f2250feaa63 Mon Sep 17 00:00:00 2001 From: Toki Date: Tue, 29 Apr 2025 23:51:20 +0200 Subject: [PATCH 7/8] update mdns toml --- Cargo.lock | 1 - libp2p/Cargo.toml | 2 +- protocols/mdns/Cargo.toml | 5 +---- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2569f4112e4..d06d1c66d6d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3003,7 +3003,6 @@ name = "libp2p-mdns" version = "0.47.0" dependencies = [ "async-io", - "async-std", "futures", "hickory-proto", "if-watch", diff --git a/libp2p/Cargo.toml b/libp2p/Cargo.toml index 09acbf86688..26609abf083 100644 --- a/libp2p/Cargo.toml +++ b/libp2p/Cargo.toml @@ -53,7 +53,7 @@ full = [ "upnp", ] -async-std = [ "libp2p-swarm/async-std", "libp2p-mdns?/async-io", "libp2p-tcp?/async-io", "libp2p-dns?/async-std", "libp2p-quic?/async-std",] +async-std = [ "libp2p-swarm/async-std", "libp2p-tcp?/async-io", "libp2p-dns?/async-std", "libp2p-quic?/async-std",] autonat = ["dep:libp2p-autonat"] cbor = ["libp2p-request-response?/cbor"] dcutr = ["dep:libp2p-dcutr", "libp2p-metrics?/dcutr"] diff --git a/protocols/mdns/Cargo.toml b/protocols/mdns/Cargo.toml index 455fca25352..519458ec916 100644 --- a/protocols/mdns/Cargo.toml +++ b/protocols/mdns/Cargo.toml @@ -11,6 +11,7 @@ keywords = ["peer-to-peer", "libp2p", "networking"] categories = ["network-programming", "asynchronous"] [dependencies] +async-io = { version = "2.3.3", optional = true } futures = { workspace = true } if-watch = { workspace = true } libp2p-core = { workspace = true } @@ -36,10 +37,6 @@ tracing-subscriber = { workspace = true, features = ["env-filter"] } name = "use-tokio" required-features = ["tokio"] -[[test]] -name = "use-tokio" -required-features = ["tokio"] - # Passing arguments to the docsrs builder in order to properly document cfg's. # More information: https://docs.rs/about/builds#cross-compiling From dc79e074a03fbbc6819fe7aac849aa056e75605b Mon Sep 17 00:00:00 2001 From: Toki Date: Thu, 1 May 2025 15:15:43 +0200 Subject: [PATCH 8/8] update --- protocols/mdns/src/behaviour/timer.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocols/mdns/src/behaviour/timer.rs b/protocols/mdns/src/behaviour/timer.rs index 5c307f47b77..cfc015adae8 100644 --- a/protocols/mdns/src/behaviour/timer.rs +++ b/protocols/mdns/src/behaviour/timer.rs @@ -22,7 +22,7 @@ use std::time::{Duration, Instant}; /// Simple wrapper for the different type of timers #[derive(Debug)] -#[cfg(any(feature = "tokio"))] +#[cfg(feature = "tokio")] pub struct Timer { inner: T, }