Kaynağa Gözat

net: p2p.stop() calls channel.stop() on all channels

zero 2 yıl önce
ebeveyn
işleme
c2c967a673
2 değiştirilmiş dosya ile 5 ekleme ve 1 silme
  1. 5 0
      src/net/p2p.rs
  2. 0 1
      src/net/session/outbound_session.rs

+ 5 - 0
src/net/p2p.rs

@@ -159,6 +159,11 @@ impl P2p {
 
     /// Stop the running P2P subsystem
     pub async fn stop(&self) {
+        // Stop all channels
+        for channel in self.hosts.channels().await {
+            channel.stop().await;
+        }
+
         // Stop the sessions
         self.session_manual().stop().await;
         self.session_inbound().stop().await;

+ 0 - 1
src/net/session/outbound_session.rs

@@ -162,7 +162,6 @@ impl Slot {
     }
 
     async fn start(self: Arc<Self>) {
-        // TODO: way too many clones, look into making this implicit. See implicit-clone crate
         let ex = self.p2p().executor();
 
         self.process.clone().start(