Skip to content

Commit

Permalink
resolving problems
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubDoka committed Aug 5, 2024
1 parent 7dd7219 commit d18e536
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 116 deletions.
2 changes: 1 addition & 1 deletion hole-punching-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ license = "MIT"
anyhow = "1"
env_logger = "0.10.2"
futures = { workspace = true }
libp2p = { path = "../libp2p", features = ["tokio", "dcutr", "identify", "macros", "noise", "ping", "relay", "tcp", "yamux", "quic"] }
libp2p = { path = "../libp2p", features = ["tokio", "dcutr", "identify", "experimental-macros", "noise", "ping", "relay", "tcp", "yamux", "quic"] }
tracing = { workspace = true }
redis = { version = "0.24.0", default-features = false, features = ["tokio-comp"] }
tokio = { workspace = true, features = ["full"] }
Expand Down
4 changes: 2 additions & 2 deletions interop-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ tracing-subscriber = { workspace = true, features = ["env-filter"] }

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
axum = "0.7"
libp2p = { path = "../libp2p", features = [ "ping", "noise", "tls", "rsa", "macros", "websocket", "tokio", "yamux", "tcp", "dns", "identify", "quic"] }
libp2p = { path = "../libp2p", features = [ "ping", "noise", "tls", "rsa", "experimental-macros", "websocket", "tokio", "yamux", "tcp", "dns", "identify", "quic"] }
libp2p-mplex = { path = "../muxers/mplex" }
libp2p-noise = { workspace = true }
libp2p-tls = { workspace = true }
Expand All @@ -40,7 +40,7 @@ tracing = { workspace = true }
tracing-subscriber = { workspace = true, features = ["env-filter"] }

[target.'cfg(target_arch = "wasm32")'.dependencies]
libp2p = { path = "../libp2p", features = [ "ping", "macros", "webtransport-websys", "wasm-bindgen", "identify", "websocket-websys", "yamux", "noise"] }
libp2p = { path = "../libp2p", features = [ "ping", "experimental-macros", "webtransport-websys", "wasm-bindgen", "identify", "websocket-websys", "yamux", "noise"] }
libp2p-mplex = { path = "../muxers/mplex" }
libp2p-webrtc-websys = { workspace = true }
wasm-bindgen = { version = "0.2" }
Expand Down
2 changes: 1 addition & 1 deletion protocols/perf/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ libp2p-core = { workspace = true }
libp2p-dns = { workspace = true, features = ["tokio"] }
libp2p-identity = { workspace = true, features = ["rand"] }
libp2p-quic = { workspace = true, features = ["tokio"] }
libp2p-swarm = { workspace = true, features = ["experimental-macros", "macros", "tokio"] }
libp2p-swarm = { workspace = true, features = ["macros", "tokio"] }
libp2p-tcp = { workspace = true, features = ["tokio"] }
libp2p-tls = { workspace = true }
libp2p-yamux = { workspace = true }
Expand Down
9 changes: 0 additions & 9 deletions swarm-derive/src/experimental.rs
Original file line number Diff line number Diff line change
Expand Up @@ -360,15 +360,6 @@ pub(crate) fn build_struct(
) -> std::task::Poll<
#connection_handler_event<Self::OutboundProtocol, Self::OutboundOpenInfo, Self::ToBehaviour>,
> {
// #(
// if let std::task::Poll::Ready(event) = self.#fields.poll(cx) {
// return std::task::Poll::Ready(event
// .map_custom(#to_beh::#var_names)
// .map_outbound_open_info(#ooi::#var_names)
// .map_protocol(#ou::#var_names));
// }
// )*

let mut fuel = #beh_count;
while fuel > 0 {
// save the poll position to avoid repolling exhaused handlers
Expand Down
2 changes: 1 addition & 1 deletion swarm-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ async-trait = "0.1.80"
libp2p-core = { workspace = true }
libp2p-identity = { workspace = true, features = ["rand"] }
libp2p-plaintext = { workspace = true }
libp2p-swarm = { workspace = true, features = ["experimental-macros", "async-std"] }
libp2p-swarm = { workspace = true, features = ["async-std"] }
libp2p-tcp = { workspace = true, features = ["async-io"] }
libp2p-yamux = { workspace = true }
futures = { workspace = true }
Expand Down
73 changes: 0 additions & 73 deletions swarm/bench.backup.txt

This file was deleted.

65 changes: 36 additions & 29 deletions swarm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,35 +122,42 @@ pub mod derive_prelude {
pub use libp2p_core::Multiaddr;
pub use libp2p_identity::PeerId;

pub type TBehaviourOutEvent<TBehaviour> = <TBehaviour as NetworkBehaviour>::ToSwarm;
pub type THandlerInProtocol<TBehaviour> =
<THandler<TBehaviour> as ConnectionHandler>::InboundProtocol;
pub type THandlerInOpenInfo<TBehaviour> =
<THandler<TBehaviour> as ConnectionHandler>::InboundOpenInfo;
pub type THandlerOutProtocol<TBehaviour> =
<THandler<TBehaviour> as ConnectionHandler>::OutboundProtocol;
pub type THandlerOutOpenInfo<TBehaviour> =
<THandler<TBehaviour> as ConnectionHandler>::OutboundOpenInfo;
pub type THandlerInUpgradeInfo<TBehaviour> =
<THandlerInProtocol<TBehaviour> as UpgradeInfoSend>::Info;
pub type THandlerOutUpgradeInfo<TBehaviour> =
<THandlerOutProtocol<TBehaviour> as UpgradeInfoSend>::Info;
pub type THandlerInUpgradeInfoIter<TBehaviour> =
<THandlerInProtocol<TBehaviour> as UpgradeInfoSend>::InfoIter;
pub type THandlerOutUpgradeInfoIter<TBehaviour> =
<THandlerOutProtocol<TBehaviour> as UpgradeInfoSend>::InfoIter;
pub type THandlerInUpgradeOutput<TBehaviour> =
<THandlerInProtocol<TBehaviour> as InboundUpgradeSend>::Output;
pub type THandlerOutUpgradeOutput<TBehaviour> =
<THandlerOutProtocol<TBehaviour> as OutboundUpgradeSend>::Output;
pub type THandlerInUpgradeError<TBehaviour> =
<THandlerInProtocol<TBehaviour> as InboundUpgradeSend>::Error;
pub type THandlerOutUpgradeError<TBehaviour> =
<THandlerOutProtocol<TBehaviour> as OutboundUpgradeSend>::Error;
pub type THandlerInUpgradeFuture<TBehaviour> =
<THandlerInProtocol<TBehaviour> as InboundUpgradeSend>::Future;
pub type THandlerOutUpgradeFuture<TBehaviour> =
<THandlerOutProtocol<TBehaviour> as OutboundUpgradeSend>::Future;
#[cfg(feature = "experimental-macros")]
#[doc(hidden)]
pub mod experimental {
use super::*;
pub type TBehaviourOutEvent<TBehaviour> = <TBehaviour as NetworkBehaviour>::ToSwarm;
pub type THandlerInProtocol<TBehaviour> =
<THandler<TBehaviour> as ConnectionHandler>::InboundProtocol;
pub type THandlerInOpenInfo<TBehaviour> =
<THandler<TBehaviour> as ConnectionHandler>::InboundOpenInfo;
pub type THandlerOutProtocol<TBehaviour> =
<THandler<TBehaviour> as ConnectionHandler>::OutboundProtocol;
pub type THandlerOutOpenInfo<TBehaviour> =
<THandler<TBehaviour> as ConnectionHandler>::OutboundOpenInfo;
pub type THandlerInUpgradeInfo<TBehaviour> =
<THandlerInProtocol<TBehaviour> as UpgradeInfoSend>::Info;
pub type THandlerOutUpgradeInfo<TBehaviour> =
<THandlerOutProtocol<TBehaviour> as UpgradeInfoSend>::Info;
pub type THandlerInUpgradeInfoIter<TBehaviour> =
<THandlerInProtocol<TBehaviour> as UpgradeInfoSend>::InfoIter;
pub type THandlerOutUpgradeInfoIter<TBehaviour> =
<THandlerOutProtocol<TBehaviour> as UpgradeInfoSend>::InfoIter;
pub type THandlerInUpgradeOutput<TBehaviour> =
<THandlerInProtocol<TBehaviour> as InboundUpgradeSend>::Output;
pub type THandlerOutUpgradeOutput<TBehaviour> =
<THandlerOutProtocol<TBehaviour> as OutboundUpgradeSend>::Output;
pub type THandlerInUpgradeError<TBehaviour> =
<THandlerInProtocol<TBehaviour> as InboundUpgradeSend>::Error;
pub type THandlerOutUpgradeError<TBehaviour> =
<THandlerOutProtocol<TBehaviour> as OutboundUpgradeSend>::Error;
pub type THandlerInUpgradeFuture<TBehaviour> =
<THandlerInProtocol<TBehaviour> as InboundUpgradeSend>::Future;
pub type THandlerOutUpgradeFuture<TBehaviour> =
<THandlerOutProtocol<TBehaviour> as OutboundUpgradeSend>::Future;
}
#[cfg(feature = "experimental-macros")]
pub use experimental::*;
}

pub use behaviour::{
Expand Down

0 comments on commit d18e536

Please sign in to comment.