Skip to content

Commit

Permalink
update wasm compilation conditions of gossipsub
Browse files Browse the repository at this point in the history
Signed-off-by: ozkanonur <work@onurozkan.dev>
  • Loading branch information
onur-ozkan committed Jul 18, 2023
1 parent b23a4a7 commit 2a2fa99
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion libp2p/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ pub use libp2p_dns as dns;
#[doc(inline)]
pub use libp2p_floodsub as floodsub;
#[cfg(feature = "gossipsub")]
#[cfg(not(target_os = "unknown"))]
#[cfg(any(not(target_os = "unknown"), target_arch = "wasm32"))]
#[doc(inline)]
pub use libp2p_gossipsub as gossipsub;
#[cfg(feature = "identify")]
Expand Down
2 changes: 1 addition & 1 deletion misc/metrics/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ libp2p-identity = { workspace = true }
prometheus-client = { version = "0.21.1"}
once_cell = "1.18.0"

[target.'cfg(not(target_os = "unknown"))'.dependencies]
[target.'cfg(any(not(target_os = "unknown"), target_arch = "wasm32"))'.dependencies]
libp2p-gossipsub = { workspace = true, optional = true }

# Passing arguments to the docsrs builder in order to properly document cfg's.
Expand Down
2 changes: 1 addition & 1 deletion misc/metrics/src/identify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const ALLOWED_PROTOCOLS: &[StreamProtocol] = &[
#[cfg(feature = "dcutr")]
libp2p_dcutr::PROTOCOL_NAME,
// #[cfg(feature = "gossipsub")]
// #[cfg(not(target_os = "unknown"))]
// #[cfg(any(not(target_os = "unknown"), target_arch = "wasm32"))]
// TODO: Add Gossipsub protocol name
libp2p_identify::PROTOCOL_NAME,
libp2p_identify::PUSH_PROTOCOL_NAME,
Expand Down
8 changes: 4 additions & 4 deletions misc/metrics/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#[cfg(feature = "dcutr")]
mod dcutr;
#[cfg(feature = "gossipsub")]
#[cfg(not(target_os = "unknown"))]
#[cfg(any(not(target_os = "unknown"), target_arch = "wasm32"))]
mod gossipsub;
#[cfg(feature = "identify")]
mod identify;
Expand All @@ -50,7 +50,7 @@ pub struct Metrics {
#[cfg(feature = "dcutr")]
dcutr: dcutr::Metrics,
#[cfg(feature = "gossipsub")]
#[cfg(not(target_os = "unknown"))]
#[cfg(any(not(target_os = "unknown"), target_arch = "wasm32"))]
gossipsub: gossipsub::Metrics,
#[cfg(feature = "identify")]
identify: identify::Metrics,
Expand Down Expand Up @@ -78,7 +78,7 @@ impl Metrics {
#[cfg(feature = "dcutr")]
dcutr: dcutr::Metrics::new(sub_registry),
#[cfg(feature = "gossipsub")]
#[cfg(not(target_os = "unknown"))]
#[cfg(any(not(target_os = "unknown"), target_arch = "wasm32"))]
gossipsub: gossipsub::Metrics::new(sub_registry),
#[cfg(feature = "identify")]
identify: identify::Metrics::new(sub_registry),
Expand Down Expand Up @@ -107,7 +107,7 @@ impl Recorder<libp2p_dcutr::Event> for Metrics {
}

#[cfg(feature = "gossipsub")]
#[cfg(not(target_os = "unknown"))]
#[cfg(any(not(target_os = "unknown"), target_arch = "wasm32"))]
impl Recorder<libp2p_gossipsub::Event> for Metrics {
fn record(&self, event: &libp2p_gossipsub::Event) {
self.gossipsub.record(event)
Expand Down

0 comments on commit 2a2fa99

Please sign in to comment.