mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-08-01 01:11:58 +00:00
protocols/ping: Properly deprecate types with Ping
prefix (#2937)
Co-authored-by: Elena Frank <elena.frank@protonmail.com> Co-authored-by: João Oliveira <hello@jxs.pt>
This commit is contained in:
@@ -25,7 +25,6 @@ use libp2p::identify::Identify;
|
||||
use libp2p::identify::IdentifyConfig;
|
||||
use libp2p::identify::IdentifyEvent;
|
||||
use libp2p::ping;
|
||||
use libp2p::ping::{Ping, PingEvent};
|
||||
use libp2p::swarm::{Swarm, SwarmEvent};
|
||||
use libp2p::NetworkBehaviour;
|
||||
use libp2p::{development_transport, rendezvous};
|
||||
@@ -54,7 +53,7 @@ async fn main() {
|
||||
identity.public(),
|
||||
)),
|
||||
rendezvous: rendezvous::server::Behaviour::new(rendezvous::server::Config::default()),
|
||||
ping: Ping::new(ping::Config::new().with_keep_alive(true)),
|
||||
ping: ping::Behaviour::new(ping::Config::new().with_keep_alive(true)),
|
||||
},
|
||||
PeerId::from(identity.public()),
|
||||
);
|
||||
@@ -104,7 +103,7 @@ async fn main() {
|
||||
#[derive(Debug)]
|
||||
enum MyEvent {
|
||||
Rendezvous(rendezvous::server::Event),
|
||||
Ping(PingEvent),
|
||||
Ping(ping::Event),
|
||||
Identify(IdentifyEvent),
|
||||
}
|
||||
|
||||
@@ -114,8 +113,8 @@ impl From<rendezvous::server::Event> for MyEvent {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<PingEvent> for MyEvent {
|
||||
fn from(event: PingEvent) -> Self {
|
||||
impl From<ping::Event> for MyEvent {
|
||||
fn from(event: ping::Event) -> Self {
|
||||
MyEvent::Ping(event)
|
||||
}
|
||||
}
|
||||
@@ -132,5 +131,5 @@ impl From<IdentifyEvent> for MyEvent {
|
||||
struct MyBehaviour {
|
||||
identify: Identify,
|
||||
rendezvous: rendezvous::server::Behaviour,
|
||||
ping: Ping,
|
||||
ping: ping::Behaviour,
|
||||
}
|
||||
|
Reference in New Issue
Block a user