diff --git a/Cargo.lock b/Cargo.lock index 650a2b700b7..b9a3df8cd5b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4011,11 +4011,10 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" name = "ping-example" version = "0.1.0" dependencies = [ - "async-std", - "async-trait", "env_logger 0.10.0", "futures", "libp2p", + "tokio", ] [[package]] diff --git a/examples/ping/Cargo.toml b/examples/ping/Cargo.toml index 33c9e56b45c..985959be301 100644 --- a/examples/ping/Cargo.toml +++ b/examples/ping/Cargo.toml @@ -6,8 +6,7 @@ publish = false license = "MIT" [dependencies] -async-std = { version = "1.12", features = ["attributes"] } -async-trait = "0.1" env_logger = "0.10.0" futures = "0.3.28" -libp2p = { path = "../../libp2p", features = ["async-std", "dns", "macros", "noise", "ping", "tcp", "websocket", "yamux"] } +libp2p = { path = "../../libp2p", features = ["noise", "ping", "tcp", "tokio", "yamux"] } +tokio = { version = "1.32.0", features = ["full"] } diff --git a/examples/ping/src/main.rs b/examples/ping/src/main.rs index 898a25813e0..25939a132c1 100644 --- a/examples/ping/src/main.rs +++ b/examples/ping/src/main.rs @@ -30,20 +30,20 @@ use libp2p::{ use std::error::Error; use std::time::Duration; -#[async_std::main] +#[tokio::main] async fn main() -> Result<(), Box> { env_logger::init(); let local_key = identity::Keypair::generate_ed25519(); let local_peer_id = PeerId::from(local_key.public()); - let transport = tcp::async_io::Transport::default() + let transport = tcp::tokio::Transport::default() .upgrade(Version::V1Lazy) .authenticate(noise::Config::new(&local_key)?) .multiplex(yamux::Config::default()) .boxed(); let mut swarm = - SwarmBuilder::with_async_std_executor(transport, ping::Behaviour::default(), local_peer_id) + SwarmBuilder::with_tokio_executor(transport, ping::Behaviour::default(), local_peer_id) .idle_connection_timeout(Duration::from_secs(60)) // For illustrative purposes, keep idle connections alive for a minute so we can observe a few pings. .build();