rachel-rose 5 лет назад
Родитель
Сommit
7c1efd0a60

+ 2 - 1
src/net/sessions/inbound_session.rs

@@ -96,7 +96,8 @@ impl InboundSession {
 
         self.attach_protocols(channel, executor).await
     }
-
+    
+    /// Network handshake.
     async fn attach_protocols(
         self: Arc<Self>,
         channel: ChannelPtr,

+ 6 - 2
src/net/sessions/seed_session.rs

@@ -21,7 +21,8 @@ impl SeedSession {
         Arc::new(Self { p2p })
     }
 
-    /// Start the seed session.
+    /// Start the seed session. Creates a new task for every seed connection and runs private
+    /// function start_seed() on each task.
     pub async fn start(self: Arc<Self>, executor: Arc<Executor<'_>>) -> NetResult<()> {
         debug!(target: "net", "SeedSession::start() [START]");
         let settings = self.p2p().settings();
@@ -69,6 +70,8 @@ impl SeedSession {
         Ok(())
     }
 
+    /// Connects to a seed socket address. Registers a new channel with a network
+    /// handshake, then starts the keep-alive messages and seed protocol.
     async fn start_seed(
         self: Arc<Self>,
         seed_index: usize,
@@ -107,7 +110,8 @@ impl SeedSession {
             }
         }
     }
-
+    
+    /// Starts keep-alive messages and seed protocol.
     async fn attach_protocols(
         self: Arc<Self>,
         channel: ChannelPtr,

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

@@ -26,7 +26,8 @@ async fn remove_sub_on_stop(p2p: P2pPtr, channel: ChannelPtr) {
 
 #[async_trait]
 pub trait Session: Sync {
-    /// Register a new channel with the session.
+    /// Registers a new channel with the session. Performs a network handshake and starts the
+    /// channel.
     async fn register_channel(
         self: Arc<Self>,
         channel: ChannelPtr,
@@ -47,8 +48,8 @@ pub trait Session: Sync {
         Ok(())
     }
 
-    /// Perform network handshake to initialize channel. Add the channel to the list of connected
-    /// channels, and prepare to remove the channel when a stop signal is received.
+    /// Performs network handshake to initialize channel. Adds the channel to the list of connected
+    /// channels, and prepares to remove the channel when a stop signal is received.
     async fn perform_handshake_protocols(
         &self,
         protocol_version: Arc<ProtocolVersion>,