aboutsummaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
authorhozan23 <hozan23@karyontech.net>2024-05-23 13:27:43 +0200
committerhozan23 <hozan23@karyontech.net>2024-05-23 13:27:43 +0200
commit681cfce4f412958dbb6dc8a1c07408826b4387a0 (patch)
tree9278976be1c59ce47f1833276007f5b45e99c2de /core/src
parentd51f212628f4996d754745b4904a1994ba39a2d0 (diff)
p2p: add peer pool logs and discovery logs to example/monitor.rs
Diffstat (limited to 'core/src')
-rw-r--r--core/src/event.rs10
1 files changed, 3 insertions, 7 deletions
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<T> {
- self.event_sys.upgrade().unwrap()
- }
}
/// An event within the [`EventSys`].