protocols/mdns: Allow users to choose between async-io and tokio runtime (#2748)

Allow users to choose between async-io and tokio runtime
in the mdns protocol implementation. `async-io` is a default
feature, with an additional `tokio` feature.

Fix high CPU usage with Tokio library.
This commit is contained in:
Yolier Galan Tasse
2022-09-01 23:53:38 -04:00
committed by GitHub
parent 36a2773861
commit 89f898c69f
12 changed files with 593 additions and 133 deletions

View File

@ -79,8 +79,11 @@ pub use libp2p_identify as identify;
#[cfg_attr(docsrs, doc(cfg(feature = "kad")))]
#[doc(inline)]
pub use libp2p_kad as kad;
#[cfg(feature = "mdns")]
#[cfg_attr(docsrs, doc(cfg(feature = "mdns")))]
#[cfg(any(feature = "mdns-async-io", feature = "mdns-tokio"))]
#[cfg_attr(
docsrs,
doc(cfg(any(feature = "mdns-tokio", feature = "mdns-async-io")))
)]
#[cfg(not(any(target_os = "emscripten", target_os = "wasi", target_os = "unknown")))]
#[doc(inline)]
pub use libp2p_mdns as mdns;