Skip to content

Commit da0403d

Browse files
umgefahrenmxinden
andauthored
protocols/mdns: Removed obsolete lazy static use from mdns (#2977)
Co-authored-by: Max Inden <[email protected]>
1 parent 4577c5a commit da0403d

File tree

4 files changed

+7
-9
lines changed

4 files changed

+7
-9
lines changed

protocols/mdns/CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@
88

99
- Fix a bug that could cause a delay of ~10s until peers would get discovered when using the tokio runtime. See [PR 2939].
1010

11+
- Removed the `lazy_static` dependency. See [PR 2977].
12+
1113
[PR 2918]: https://github.com/libp2p/rust-libp2p/pull/2918
1214
[PR 2939]: https://github.com/libp2p/rust-libp2p/pull/2939
15+
[PR 2977]: https://github.com/libp2p/rust-libp2p/pull/2977
1316

1417
# 0.40.0
1518

protocols/mdns/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ data-encoding = "2.3.2"
1515
dns-parser = "0.8.0"
1616
futures = "0.3.13"
1717
if-watch = "1.1.1"
18-
lazy_static = "1.4.0"
1918
libp2p-core = { version = "0.37.0", path = "../../core" }
2019
libp2p-swarm = { version = "0.40.0", path = "../../swarm" }
2120
log = "0.4.14"

protocols/mdns/src/behaviour/iface.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ where
120120
config.query_interval + Duration::from_millis(jitter)
121121
};
122122
let multicast_addr = match addr {
123-
IpAddr::V4(_) => IpAddr::V4(*crate::IPV4_MDNS_MULTICAST_ADDRESS),
124-
IpAddr::V6(_) => IpAddr::V6(*crate::IPV6_MDNS_MULTICAST_ADDRESS),
123+
IpAddr::V4(_) => IpAddr::V4(crate::IPV4_MDNS_MULTICAST_ADDRESS),
124+
IpAddr::V6(_) => IpAddr::V6(crate::IPV6_MDNS_MULTICAST_ADDRESS),
125125
};
126126
Ok(Self {
127127
addr,

protocols/mdns/src/lib.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
//! implements the `NetworkBehaviour` trait. This struct will automatically discover other
3131
//! libp2p nodes on the local network.
3232
//!
33-
use lazy_static::lazy_static;
3433
use std::net::{Ipv4Addr, Ipv6Addr};
3534
use std::time::Duration;
3635

@@ -48,11 +47,8 @@ const SERVICE_NAME: &[u8] = b"_p2p._udp.local";
4847
/// The meta query for looking up the `SERVICE_NAME`.
4948
const META_QUERY_SERVICE: &[u8] = b"_services._dns-sd._udp.local";
5049

51-
lazy_static! {
52-
pub static ref IPV4_MDNS_MULTICAST_ADDRESS: Ipv4Addr = Ipv4Addr::new(224, 0, 0, 251);
53-
pub static ref IPV6_MDNS_MULTICAST_ADDRESS: Ipv6Addr =
54-
Ipv6Addr::new(0xFF02, 0, 0, 0, 0, 0, 0, 0xFB);
55-
}
50+
pub const IPV4_MDNS_MULTICAST_ADDRESS: Ipv4Addr = Ipv4Addr::new(224, 0, 0, 251);
51+
pub const IPV6_MDNS_MULTICAST_ADDRESS: Ipv6Addr = Ipv6Addr::new(0xFF02, 0, 0, 0, 0, 0, 0, 0xFB);
5652

5753
/// Configuration for mDNS.
5854
#[derive(Debug, Clone)]

0 commit comments

Comments
 (0)