aboutsummaryrefslogtreecommitdiff
path: root/p2p/src/peer_pool.rs
diff options
context:
space:
mode:
authorhozan23 <hozan23@karyontech.net>2024-06-24 13:25:39 +0200
committerhozan23 <hozan23@karyontech.net>2024-06-24 13:25:39 +0200
commite3d1f4fd91a5f077fda8a1976e194c378ee166d0 (patch)
treec6d0c3d8777705202a88f838675eee85cd7e941d /p2p/src/peer_pool.rs
parent135968d8f1379a6d2f32cbbc3e5b77a5f317a4d6 (diff)
p2p/monitor: use struct instead of enum for monitor events
Diffstat (limited to 'p2p/src/peer_pool.rs')
-rw-r--r--p2p/src/peer_pool.rs10
1 files changed, 3 insertions, 7 deletions
diff --git a/p2p/src/peer_pool.rs b/p2p/src/peer_pool.rs
index 79fd4b4..6c895a0 100644
--- a/p2p/src/peer_pool.rs
+++ b/p2p/src/peer_pool.rs
@@ -23,7 +23,7 @@ use crate::{
config::Config,
conn_queue::{ConnDirection, ConnQueue},
message::{get_msg_payload, NetMsg, NetMsgCmd, VerAckMsg, VerMsg},
- monitor::{Monitor, PeerPoolEvent},
+ monitor::{Monitor, PPEvent},
peer::{ArcPeer, Peer, PeerID},
protocol::{Protocol, ProtocolConstructor, ProtocolID},
protocols::PingProtocol,
@@ -192,9 +192,7 @@ impl PeerPool {
info!("Add new peer {pid}, direction: {conn_direction}, endpoint: {endpoint}");
- self.monitor
- .notify(PeerPoolEvent::NewPeer(pid.clone()))
- .await;
+ self.monitor.notify(PPEvent::NewPeer(pid.clone())).await;
Ok(())
}
@@ -215,9 +213,7 @@ impl PeerPool {
peer.shutdown().await;
- self.monitor
- .notify(PeerPoolEvent::RemovePeer(pid.clone()))
- .await;
+ self.monitor.notify(PPEvent::RemovePeer(pid.clone())).await;
let endpoint = peer.remote_endpoint();
let direction = peer.direction();