Przeglądaj źródła

net/outbound_session: start() doesnt return Err so remove error handling and result

x 3 lat temu
rodzic
commit
61c269f776

+ 1 - 6
src/net/p2p.rs

@@ -145,12 +145,7 @@ impl P2p {
 
         // Start the outbound session
         let outbound = self.session_outbound().await;
-        if let Err(err) = outbound.clone().start().await {
-            error!(target: "net::p2p::start()", "Failed to start outbound session!: {}", err);
-            manual.stop().await;
-            inbound.stop().await;
-            return Err(err)
-        }
+        outbound.clone().start().await;
 
         info!(target: "net::p2p::start()", "[P2P] P2P subsystem started");
         Ok(())

+ 1 - 1
src/net/session/inbound_session.rs

@@ -119,7 +119,7 @@ impl InboundSession {
 
         // Start listener
         let result = acceptor.clone().start(accept_addr, ex).await;
-        if let Err(e) = result.clone() {
+        if let Err(e) = &result {
             error!(target: "net::inbound_session", "[P2P] Error starting listener #{}: {}", index, e);
             acceptor.stop().await;
         } else {

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

@@ -81,7 +81,7 @@ impl OutboundSession {
     }
 
     /// Start the outbound session. Runs the channel connect loop.
-    pub(crate) async fn start(self: Arc<Self>) -> Result<()> {
+    pub(crate) async fn start(self: Arc<Self>) {
         let n_slots = self.p2p().settings().outbound_connections;
         info!(target: "net::outbound_session", "[P2P] Starting {} outbound connection slots.", n_slots);
         // Activate mutex lock on connection slots.
@@ -94,8 +94,6 @@ impl OutboundSession {
             slot.clone().start().await;
             slots.push(slot);
         }
-
-        Ok(())
     }
 
     /// Stops the outbound session.