Sfoglia il codice sorgente

chore: fix comments and cleanup

draoi 2 anni fa
parent
commit
ccf660b924

+ 2 - 0
src/net/hosts/refinery.rs

@@ -166,8 +166,10 @@ async fn ping_node_impl(addr: Url, p2p: P2pPtr) -> bool {
     match connector.connect(&addr).await {
     match connector.connect(&addr).await {
         Ok((_url, channel)) => {
         Ok((_url, channel)) => {
             debug!(target: "net::refinery::ping_node()", "Connected successfully!");
             debug!(target: "net::refinery::ping_node()", "Connected successfully!");
+            // First initialize the version protocol and its Version, Verack subscribers.  
             let proto_ver = ProtocolVersion::new(channel.clone(), p2p.settings()).await;
             let proto_ver = ProtocolVersion::new(channel.clone(), p2p.settings()).await;
 
 
+            // Then run the version exchange, store the channel and subscribe to a stop signal.
             let handshake_task = session_outbound.perform_handshake_protocols(
             let handshake_task = session_outbound.perform_handshake_protocols(
                 proto_ver,
                 proto_ver,
                 channel.clone(),
                 channel.clone(),

+ 3 - 4
src/net/session/inbound_session.rs

@@ -86,10 +86,9 @@ impl InboundSession {
             // prepared by the Acceptor.
             // prepared by the Acceptor.
             let channel_sub = acceptor.clone().subscribe().await;
             let channel_sub = acceptor.clone().subscribe().await;
 
 
-            let task = StoppableTask::new();
-
             // Then start listening for a Channel returned by the Subscriber. Call setup_channel()
             // Then start listening for a Channel returned by the Subscriber. Call setup_channel()
             // to register the Channel when it has been received.
             // to register the Channel when it has been received.
+            let task = StoppableTask::new();
             task.clone().start(
             task.clone().start(
                 self.clone().channel_sub_loop(channel_sub, index, ex.clone()),
                 self.clone().channel_sub_loop(channel_sub, index, ex.clone()),
                 // Ignore stop handler
                 // Ignore stop handler
@@ -100,8 +99,8 @@ impl InboundSession {
 
 
             accept_tasks.push(task);
             accept_tasks.push(task);
 
 
-            // Finally, run the Acceptor to start accepting inbound connections. Only when Subscribers
-            // have been set up can we safely do this.
+            // Finally, run the Acceptor to start accepting inbound connections. Only when
+            // the Subscriber has been set up can we safely do this.
             self.clone()
             self.clone()
                 .start_accept_session(index, accept_addr.clone(), acceptor, ex.clone())
                 .start_accept_session(index, accept_addr.clone(), acceptor, ex.clone())
                 .await?;
                 .await?;

+ 0 - 3
src/net/session/manual_session.rs

@@ -158,9 +158,6 @@ impl ManualSession {
                         "[P2P] Unable to connect to manual outbound [{}]: {}",
                         "[P2P] Unable to connect to manual outbound [{}]: {}",
                         addr, e,
                         addr, e,
                     );
                     );
-
-                    // Downgrade this host to greylist if it's on the whitelist or anchorlist.
-                    //self.downgrade_host(&addr).await;
                 }
                 }
             }
             }