Sfoglia il codice sorgente

p2p: better start(), stop() sequences

Before we would start the refine() session first because it contains a
SelfHandshake that ProtocolAddr/Seed were dependent on.

Since it's an internal process that deals with locks and HostState it
feels more logical to start() stop() it last in the sequence.
draoi 2 anni fa
parent
commit
0dea915843
1 ha cambiato i file con 5 aggiunte e 5 eliminazioni
  1. 5 5
      src/net/p2p.rs

+ 5 - 5
src/net/p2p.rs

@@ -122,9 +122,6 @@ impl P2p {
             return Err(err)
         }
 
-        // Start the refine session
-        self.session_refine().start().await;
-
         // Start the seedsync session. Seed connections will not
         // activate yet- they wait for a call to notify().
         self.session_seedsync().start().await;
@@ -132,6 +129,9 @@ impl P2p {
         // Start the outbound session
         self.session_outbound().start().await;
 
+        // Start the refine session
+        self.session_refine().start().await;
+
         info!(target: "net::p2p::start()", "[P2P] P2P subsystem started");
         Ok(())
     }
@@ -157,9 +157,9 @@ impl P2p {
         // Stop the sessions
         self.session_manual().stop().await;
         self.session_inbound().stop().await;
-        self.session_refine().stop().await;
-        self.session_outbound().stop().await;
         self.session_seedsync().stop().await;
+        self.session_outbound().stop().await;
+        self.session_refine().stop().await;
     }
 
     /// Broadcasts a message concurrently across all active channels.