Skip to content

Commit

Permalink
migrate test to tokio
Browse files Browse the repository at this point in the history
  • Loading branch information
drHuangMHT committed Feb 4, 2025
1 parent 8f0cccc commit 7817ae0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions misc/connection-limits/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -579,13 +579,14 @@ mod tests {
)
});

let rt = Runtime::new().unwrap();
let bypassed_peer_id = *swarm3.local_peer_id();
swarm1
.behaviour_mut()
.limits
.bypass_peer_id(&bypassed_peer_id);

async_std::task::block_on(async {
rt.block_on(async {
let (listen_addr, _) = swarm1.listen().with_memory_addr_external().await;

for _ in 0..limit {
Expand All @@ -594,8 +595,8 @@ mod tests {

swarm3.dial(listen_addr.clone()).unwrap();

async_std::task::spawn(swarm2.loop_on_next());
async_std::task::spawn(swarm3.loop_on_next());
tokio::spawn(swarm2.loop_on_next());
tokio::spawn(swarm3.loop_on_next());

swarm1
.wait(|event| match event {
Expand Down

0 comments on commit 7817ae0

Please sign in to comment.