Skip to content

Commit 8ee6e32

Browse files
authored
chore(swarm): use tokio instead of async_std
ref #4449 Pull-Request: #6037.
1 parent c54c0f2 commit 8ee6e32

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

swarm/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ async-std = ["dep:async-std"]
3838
wasm-bindgen = ["dep:wasm-bindgen-futures", "dep:getrandom"]
3939

4040
[dev-dependencies]
41-
async-std = { version = "1.6.2", features = ["attributes"] }
4241
either = "1.11.0"
4342
futures = { workspace = true }
4443
libp2p-identify = { path = "../protocols/identify" } # Using `path` here because this is a cyclic dev-dependency which otherwise breaks releasing.
@@ -47,7 +46,7 @@ libp2p-kad = { path = "../protocols/kad" } # Using `pat
4746
libp2p-ping = { path = "../protocols/ping" } # Using `path` here because this is a cyclic dev-dependency which otherwise breaks releasing.
4847
libp2p-plaintext = { path = "../transports/plaintext" } # Using `path` here because this is a cyclic dev-dependency which otherwise breaks releasing.
4948
libp2p-swarm-derive = { path = "../swarm-derive" } # Using `path` here because this is a cyclic dev-dependency which otherwise breaks releasing.
50-
libp2p-swarm-test = { path = "../swarm-test", features = ["async-std"]} # Using `path` here because this is a cyclic dev-dependency which otherwise breaks releasing.
49+
libp2p-swarm-test = { path = "../swarm-test", features = ["tokio"] }# Using `path` here because this is a cyclic dev-dependency which otherwise breaks releasing.
5150
libp2p-yamux = { path = "../muxers/yamux" } # Using `path` here because this is a cyclic dev-dependency which otherwise breaks releasing.
5251
quickcheck = { workspace = true }
5352
criterion = { version = "0.5", features = ["async_tokio"] }

swarm/tests/connection_close.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ use libp2p_swarm::{
1212
};
1313
use libp2p_swarm_test::SwarmExt;
1414

15-
#[async_std::test]
15+
#[tokio::test]
1616
async fn sends_remaining_events_to_behaviour_on_connection_close() {
17-
let mut swarm1 = Swarm::new_ephemeral(|_| Behaviour::new(3));
18-
let mut swarm2 = Swarm::new_ephemeral(|_| Behaviour::new(3));
17+
let mut swarm1 = Swarm::new_ephemeral_tokio(|_| Behaviour::new(3));
18+
let mut swarm2 = Swarm::new_ephemeral_tokio(|_| Behaviour::new(3));
1919

2020
swarm2.listen().with_memory_addr_external().await;
2121
swarm1.connect(&mut swarm2).await;

swarm/tests/listener.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ use libp2p_swarm::{
1717
};
1818
use libp2p_swarm_test::SwarmExt;
1919

20-
#[async_std::test]
20+
#[tokio::test]
2121
async fn behaviour_listener() {
22-
let mut swarm = Swarm::new_ephemeral(|_| Behaviour::default());
22+
let mut swarm = Swarm::new_ephemeral_tokio(|_| Behaviour::default());
2323
let addr: Multiaddr = Protocol::Memory(0).into();
2424
let id = swarm.behaviour_mut().listen(addr.clone());
2525

0 commit comments

Comments
 (0)