From e8bbe6be115a43cce4cb72364aa4a90825454236 Mon Sep 17 00:00:00 2001 From: umgefahren <55623006+umgefahren@users.noreply.github.com> Date: Tue, 4 Oct 2022 15:21:36 +0200 Subject: [PATCH 1/2] Removed obsolete lazy static use from mdns --- protocols/mdns/Cargo.toml | 1 - protocols/mdns/src/behaviour/iface.rs | 4 ++-- protocols/mdns/src/lib.rs | 8 ++------ 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/protocols/mdns/Cargo.toml b/protocols/mdns/Cargo.toml index 466c9eb9e25..8102e6d28ec 100644 --- a/protocols/mdns/Cargo.toml +++ b/protocols/mdns/Cargo.toml @@ -15,7 +15,6 @@ data-encoding = "2.3.2" dns-parser = "0.8.0" futures = "0.3.13" if-watch = "1.1.1" -lazy_static = "1.4.0" libp2p-core = { version = "0.37.0", path = "../../core" } libp2p-swarm = { version = "0.40.0", path = "../../swarm" } log = "0.4.14" diff --git a/protocols/mdns/src/behaviour/iface.rs b/protocols/mdns/src/behaviour/iface.rs index 0ca9cb3d841..e1768720ef9 100644 --- a/protocols/mdns/src/behaviour/iface.rs +++ b/protocols/mdns/src/behaviour/iface.rs @@ -120,8 +120,8 @@ where config.query_interval + Duration::from_millis(jitter) }; let multicast_addr = match addr { - IpAddr::V4(_) => IpAddr::V4(*crate::IPV4_MDNS_MULTICAST_ADDRESS), - IpAddr::V6(_) => IpAddr::V6(*crate::IPV6_MDNS_MULTICAST_ADDRESS), + IpAddr::V4(_) => IpAddr::V4(crate::IPV4_MDNS_MULTICAST_ADDRESS), + IpAddr::V6(_) => IpAddr::V6(crate::IPV6_MDNS_MULTICAST_ADDRESS), }; Ok(Self { addr, diff --git a/protocols/mdns/src/lib.rs b/protocols/mdns/src/lib.rs index 3b484c91daa..f05476af7dd 100644 --- a/protocols/mdns/src/lib.rs +++ b/protocols/mdns/src/lib.rs @@ -30,7 +30,6 @@ //! implements the `NetworkBehaviour` trait. This struct will automatically discover other //! libp2p nodes on the local network. //! -use lazy_static::lazy_static; use std::net::{Ipv4Addr, Ipv6Addr}; use std::time::Duration; @@ -48,11 +47,8 @@ const SERVICE_NAME: &[u8] = b"_p2p._udp.local"; /// The meta query for looking up the `SERVICE_NAME`. const META_QUERY_SERVICE: &[u8] = b"_services._dns-sd._udp.local"; -lazy_static! { - pub static ref IPV4_MDNS_MULTICAST_ADDRESS: Ipv4Addr = Ipv4Addr::new(224, 0, 0, 251); - pub static ref IPV6_MDNS_MULTICAST_ADDRESS: Ipv6Addr = - Ipv6Addr::new(0xFF02, 0, 0, 0, 0, 0, 0, 0xFB); -} +pub const IPV4_MDNS_MULTICAST_ADDRESS: Ipv4Addr = Ipv4Addr::new(224, 0, 0, 251); +pub const IPV6_MDNS_MULTICAST_ADDRESS: Ipv6Addr = Ipv6Addr::new(0xFF02, 0, 0, 0, 0, 0, 0, 0xFB); /// Configuration for mDNS. #[derive(Debug, Clone)] From e115524dc8c3b5062e9c3b5b60ba75fb4f0b6382 Mon Sep 17 00:00:00 2001 From: umgefahren <55623006+umgefahren@users.noreply.github.com> Date: Tue, 4 Oct 2022 15:31:33 +0200 Subject: [PATCH 2/2] Added a changelog entry --- protocols/mdns/CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/protocols/mdns/CHANGELOG.md b/protocols/mdns/CHANGELOG.md index d0562caa511..0943140dd02 100644 --- a/protocols/mdns/CHANGELOG.md +++ b/protocols/mdns/CHANGELOG.md @@ -8,8 +8,11 @@ - Fix a bug that could cause a delay of ~10s until peers would get discovered when using the tokio runtime. See [PR 2939]. +- Removed the `lazy_static` dependency. See [PR 2977]. + [PR 2918]: https://github.com/libp2p/rust-libp2p/pull/2918 [PR 2939]: https://github.com/libp2p/rust-libp2p/pull/2939 +[PR 2977]: https://github.com/libp2p/rust-libp2p/pull/2977 # 0.40.0