diff options
author | hozan23 <hozan23@karyontech.net> | 2024-06-24 13:25:39 +0200 |
---|---|---|
committer | hozan23 <hozan23@karyontech.net> | 2024-06-24 13:25:39 +0200 |
commit | e3d1f4fd91a5f077fda8a1976e194c378ee166d0 (patch) | |
tree | c6d0c3d8777705202a88f838675eee85cd7e941d /p2p/src/discovery | |
parent | 135968d8f1379a6d2f32cbbc3e5b77a5f317a4d6 (diff) |
p2p/monitor: use struct instead of enum for monitor events
Diffstat (limited to 'p2p/src/discovery')
-rw-r--r-- | p2p/src/discovery/lookup.rs | 8 | ||||
-rw-r--r-- | p2p/src/discovery/refresh.rs | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/p2p/src/discovery/lookup.rs b/p2p/src/discovery/lookup.rs index 677bad7..a941986 100644 --- a/p2p/src/discovery/lookup.rs +++ b/p2p/src/discovery/lookup.rs @@ -20,7 +20,7 @@ use crate::{ get_msg_payload, FindPeerMsg, NetMsg, NetMsgCmd, PeerMsg, PeersMsg, PingMsg, PongMsg, ShutdownMsg, }, - monitor::{ConnEvent, DiscoveryEvent, Monitor}, + monitor::{ConnEvent, DiscvEvent, Monitor}, routing_table::RoutingTable, slots::ConnectionSlots, version::version_match, @@ -131,7 +131,7 @@ impl LookupService { pub async fn start_lookup(&self, endpoint: &Endpoint, peer_id: Option<PeerID>) -> Result<()> { trace!("Lookup started {endpoint}"); self.monitor - .notify(DiscoveryEvent::LookupStarted(endpoint.clone())) + .notify(DiscvEvent::LookupStarted(endpoint.clone())) .await; let mut random_peers = vec![]; @@ -140,7 +140,7 @@ impl LookupService { .await { self.monitor - .notify(DiscoveryEvent::LookupFailed(endpoint.clone())) + .notify(DiscvEvent::LookupFailed(endpoint.clone())) .await; return Err(err); }; @@ -161,7 +161,7 @@ impl LookupService { } self.monitor - .notify(DiscoveryEvent::LookupSucceeded( + .notify(DiscvEvent::LookupSucceeded( endpoint.clone(), peer_buffer.len(), )) diff --git a/p2p/src/discovery/refresh.rs b/p2p/src/discovery/refresh.rs index eec6743..c1d222b 100644 --- a/p2p/src/discovery/refresh.rs +++ b/p2p/src/discovery/refresh.rs @@ -14,7 +14,7 @@ use karyon_net::{udp, Connection, Endpoint, Error as NetError}; use crate::{ codec::RefreshMsgCodec, message::RefreshMsg, - monitor::{ConnEvent, DiscoveryEvent, Monitor}, + monitor::{ConnEvent, DiscvEvent, Monitor}, routing_table::{BucketEntry, Entry, RoutingTable, PENDING_ENTRY, UNREACHABLE_ENTRY}, Config, Error, Result, }; @@ -116,7 +116,7 @@ impl RefreshService { sleep(Duration::from_secs(self.config.refresh_interval)).await; trace!("Start refreshing the routing table..."); - self.monitor.notify(DiscoveryEvent::RefreshStarted).await; + self.monitor.notify(DiscvEvent::RefreshStarted).await; let mut entries: Vec<BucketEntry> = vec![]; for bucket in self.table.buckets() { |