Skip to content

Commit

Permalink
fix p2p test
Browse files Browse the repository at this point in the history
  • Loading branch information
hmzakhalid committed Jan 3, 2025
1 parent 5e77979 commit 9cdf56c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
5 changes: 3 additions & 2 deletions packages/ciphernode/net/src/bin/p2p_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,14 @@ async fn main() -> Result<()> {
.into_iter()
.filter(|n| *n != name)
.collect();

println!("{} waiting for messages from: {:?}", name, expected);

// Then wait to receive from others with a timeout
let mut received = HashSet::new();
let receive_result = timeout(Duration::from_secs(10), async {
let history = net_bus.send(GetHistory::<NetworkPeerEvent>::new()).await?;
println!("{} history: {:?}", name, history);
while received != expected {
let history = net_bus.send(GetHistory::<NetworkPeerEvent>::new()).await?;
for event in history.clone() {
match event {
NetworkPeerEvent::GossipData(msg) => {
Expand All @@ -114,6 +114,7 @@ async fn main() -> Result<()> {
_ => (),
}
}
tokio::time::sleep(Duration::from_secs(1)).await;
}
Ok::<(), anyhow::Error>(())
})
Expand Down
1 change: 0 additions & 1 deletion packages/ciphernode/net/src/network_peer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ impl NetworkPeer {
}
}
NetworkPeerCommand::Dial(multi) => {
info!("DIAL: {:?}", multi);
let connection_id = multi.connection_id();
match self.swarm.dial(multi) {
Ok(v) => {
Expand Down

0 comments on commit 9cdf56c

Please sign in to comment.