diff options
author | hozan23 <hozan23@karyontech.net> | 2024-05-22 18:02:51 +0200 |
---|---|---|
committer | hozan23 <hozan23@karyontech.net> | 2024-05-22 18:02:51 +0200 |
commit | 5df6812dd2254b871eb773dc626b89646ca87495 (patch) | |
tree | 18828be9c86aba205d30086f705f2c6e2aeee975 /p2p/src/listener.rs | |
parent | c2860d3266aa1233787400b163d527fdc7dafe61 (diff) |
p2p: monitor system use core::EventSys instead of pubsub pattern
Diffstat (limited to 'p2p/src/listener.rs')
-rw-r--r-- | p2p/src/listener.rs | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/p2p/src/listener.rs b/p2p/src/listener.rs index 1abf79a..923eb18 100644 --- a/p2p/src/listener.rs +++ b/p2p/src/listener.rs @@ -72,15 +72,13 @@ impl Listener { let listener = match self.listen(&endpoint).await { Ok(listener) => { self.monitor - .notify(&ConnEvent::Listening(endpoint.clone()).into()) + .notify(ConnEvent::Listening(endpoint.clone())) .await; listener } Err(err) => { error!("Failed to listen on {endpoint}: {err}"); - self.monitor - .notify(&ConnEvent::ListenFailed(endpoint).into()) - .await; + self.monitor.notify(ConnEvent::ListenFailed(endpoint)).await; return Err(err); } }; @@ -117,20 +115,20 @@ impl Listener { let endpoint = match c.peer_endpoint() { Ok(ep) => ep, Err(err) => { - self.monitor.notify(&ConnEvent::AcceptFailed.into()).await; + self.monitor.notify(ConnEvent::AcceptFailed).await; error!("Failed to accept a new connection: {err}"); continue; } }; self.monitor - .notify(&ConnEvent::Accepted(endpoint.clone()).into()) + .notify(ConnEvent::Accepted(endpoint.clone())) .await; (c, endpoint) } Err(err) => { error!("Failed to accept a new connection: {err}"); - self.monitor.notify(&ConnEvent::AcceptFailed.into()).await; + self.monitor.notify(ConnEvent::AcceptFailed).await; continue; } }; @@ -144,7 +142,7 @@ impl Listener { } selfc .monitor - .notify(&ConnEvent::Disconnected(endpoint).into()) + .notify(ConnEvent::Disconnected(endpoint)) .await; selfc.connection_slots.remove().await; }; |