From 5df6812dd2254b871eb773dc626b89646ca87495 Mon Sep 17 00:00:00 2001 From: hozan23 Date: Wed, 22 May 2024 18:02:51 +0200 Subject: p2p: monitor system use core::EventSys instead of pubsub pattern --- p2p/src/backend.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'p2p/src/backend.rs') diff --git a/p2p/src/backend.rs b/p2p/src/backend.rs index 2f21b3e..c05a693 100644 --- a/p2p/src/backend.rs +++ b/p2p/src/backend.rs @@ -2,13 +2,13 @@ use std::sync::Arc; use log::info; -use karyon_core::{async_runtime::Executor, crypto::KeyPair, pubsub::Subscription}; +use karyon_core::{async_runtime::Executor, crypto::KeyPair}; use crate::{ config::Config, connection::ConnQueue, discovery::{ArcDiscovery, Discovery}, - monitor::{Monitor, MonitorEvent}, + monitor::Monitor, peer_pool::PeerPool, protocol::{ArcProtocol, Protocol}, ArcPeer, PeerID, Result, @@ -112,9 +112,9 @@ impl Backend { self.discovery.outbound_slots.load() } - /// Subscribes to the monitor to receive network events. - pub async fn monitor(&self) -> Subscription { - self.monitor.subscribe().await + /// Returns the monitor to receive system events. + pub fn monitor(&self) -> Arc { + self.monitor.clone() } /// Shuts down the Backend. -- cgit v1.2.3