diff --git a/protocols/dcutr/tests/lib.rs b/protocols/dcutr/tests/lib.rs index a53a5319f34..6a10d1049e4 100644 --- a/protocols/dcutr/tests/lib.rs +++ b/protocols/dcutr/tests/lib.rs @@ -175,7 +175,7 @@ impl From for ClientEvent { } } -fn spawn_swarm_on_pool(pool: &LocalPool, swarm: Swarm) { +fn spawn_swarm_on_pool(pool: &LocalPool, swarm: Swarm) { pool.spawner() .spawn_obj(swarm.collect::>().map(|_| ()).boxed().into()) .unwrap(); diff --git a/protocols/relay/tests/v1.rs b/protocols/relay/tests/v1.rs index 6d6f97ac700..1da368f68c2 100644 --- a/protocols/relay/tests/v1.rs +++ b/protocols/relay/tests/v1.rs @@ -1369,7 +1369,7 @@ fn build_keep_alive_only_swarm() -> Swarm { ) } -fn spawn_swarm_on_pool(pool: &LocalPool, mut swarm: Swarm) { +fn spawn_swarm_on_pool(pool: &LocalPool, mut swarm: Swarm) { pool.spawner() .spawn_obj( async move { diff --git a/protocols/relay/tests/v2.rs b/protocols/relay/tests/v2.rs index ea4b8b8fb3c..c0d084aa606 100644 --- a/protocols/relay/tests/v2.rs +++ b/protocols/relay/tests/v2.rs @@ -397,7 +397,7 @@ impl From for ClientEvent { } } -fn spawn_swarm_on_pool(pool: &LocalPool, swarm: Swarm) { +fn spawn_swarm_on_pool(pool: &LocalPool, swarm: Swarm) { pool.spawner() .spawn_obj(swarm.collect::>().map(|_| ()).boxed().into()) .unwrap(); diff --git a/protocols/rendezvous/tests/harness.rs b/protocols/rendezvous/tests/harness.rs index 3709e509a06..3602d666c0f 100644 --- a/protocols/rendezvous/tests/harness.rs +++ b/protocols/rendezvous/tests/harness.rs @@ -140,7 +140,7 @@ pub trait SwarmExt { /// Establishes a connection to the given [`Swarm`], polling both of them until the connection is established. async fn block_on_connection(&mut self, other: &mut Swarm) where - T: NetworkBehaviour, + T: NetworkBehaviour + Send, ::OutEvent: Debug; /// Listens on a random memory address, polling the [`Swarm`] until the transport is ready to accept connections. @@ -153,12 +153,12 @@ pub trait SwarmExt { #[async_trait] impl SwarmExt for Swarm where - B: NetworkBehaviour, + B: NetworkBehaviour + Send, ::OutEvent: Debug, { async fn block_on_connection(&mut self, other: &mut Swarm) where - T: NetworkBehaviour, + T: NetworkBehaviour + Send, ::OutEvent: Debug, { let addr_to_dial = other.external_addresses().next().unwrap().addr.clone(); diff --git a/swarm/CHANGELOG.md b/swarm/CHANGELOG.md index a142e2327a2..9a491198a9b 100644 --- a/swarm/CHANGELOG.md +++ b/swarm/CHANGELOG.md @@ -1,3 +1,8 @@ + +# Unreleased + +- Remove `Send` bound from `NetworkBehaviour`. + # 0.34.0 [2022-02-22] - Rename `ProtocolsHandler` to `ConnectionHandler`. Upgrade should be as simple as renaming all diff --git a/swarm/src/behaviour.rs b/swarm/src/behaviour.rs index 20b607c3342..6e2a163cc2c 100644 --- a/swarm/src/behaviour.rs +++ b/swarm/src/behaviour.rs @@ -165,7 +165,7 @@ pub(crate) type THandlerOutEvent = /// Optionally one can provide a custom `poll` function through the `#[behaviour(poll_method = /// "poll")]` attribute. This function must have the same signature as the [`NetworkBehaviour#poll`] /// function and will be called last within the generated [`NetworkBehaviour`] implementation. -pub trait NetworkBehaviour: Send + 'static { +pub trait NetworkBehaviour: 'static { /// Handler for all the protocols the network behaviour supports. type ConnectionHandler: IntoConnectionHandler;