Pārlūkot izejas kodu

net/p2p: Expose the dnet subscriber through a function.

parazyd 3 gadi atpakaļ
vecāks
revīzija
017cf68480
1 mainītis faili ar 4 papildinājumiem un 2 dzēšanām
  1. 4 2
      src/net/p2p.rs

+ 4 - 2
src/net/p2p.rs

@@ -320,9 +320,11 @@ impl P2p {
     }
     }
 
 
     /// Return a reference to the dnet subscriber
     /// Return a reference to the dnet subscriber
-    pub async fn dnet_subscribe(&self) -> Subscription<DnetEvent> {
-        self.dnet_sub.clone().subscribe().await
+    pub fn dnet_sub(&self) -> SubscriberPtr<DnetEvent> {
+        self.dnet_sub.clone()
     }
     }
+
+    /// Send a dnet notification over the subscriber
     pub async fn dnet_notify(&self, event: DnetEvent) {
     pub async fn dnet_notify(&self, event: DnetEvent) {
         self.dnet_sub.notify(event).await;
         self.dnet_sub.notify(event).await;
     }
     }