From 681cfce4f412958dbb6dc8a1c07408826b4387a0 Mon Sep 17 00:00:00 2001 From: hozan23 Date: Thu, 23 May 2024 13:27:43 +0200 Subject: p2p: add peer pool logs and discovery logs to example/monitor.rs --- core/src/event.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'core') diff --git a/core/src/event.rs b/core/src/event.rs index 876fda5..a32677b 100644 --- a/core/src/event.rs +++ b/core/src/event.rs @@ -243,9 +243,9 @@ where /// Cancels the listener and removes it from the `EventSys`. pub async fn cancel(&self) { - self.event_sys() - .remove(&self.topic, &self.event_id, &self.id) - .await; + if let Some(es) = self.event_sys.upgrade() { + es.remove(&self.topic, &self.event_id, &self.id).await; + } } /// Returns the topic for this event listener. @@ -257,10 +257,6 @@ where pub async fn event_id(&self) -> &String { &self.event_id } - - fn event_sys(&self) -> ArcEventSys { - self.event_sys.upgrade().unwrap() - } } /// An event within the [`EventSys`]. -- cgit v1.2.3