Просмотр исходного кода

fixed protocol doc formatting to work with inline tool

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

+ 8 - 8
src/net/protocols/protocol_address.rs

@@ -21,8 +21,8 @@ pub struct ProtocolAddress {
 }
 
 impl ProtocolAddress {
-    /// Create a new address protocol. Makes an address and get-address subscription and adds them
-    /// to the address protocol instance.
+    /// Create a new address protocol. Makes an address and get-address subscription
+    /// and adds them to the address protocol instance.
     pub async fn new(channel: ChannelPtr, hosts: HostsPtr) -> Arc<Self> {
         // Creates a subscription to address message.
         let addrs_sub = channel
@@ -47,8 +47,8 @@ impl ProtocolAddress {
         })
     }
 
-    /// Starts the address protocol. Runs receive address and get address protocols on the protocol
-    /// task manager. Then sends get-address message.
+    /// Starts the address protocol. Runs receive address and get address protocols
+    /// on the protocol task manager. Then sends get-address message.
     pub async fn start(self: Arc<Self>, executor: Arc<Executor<'_>>) {
         debug!(target: "net", "ProtocolAddress::start() [START]");
         self.jobsman.clone().start(executor.clone());
@@ -67,8 +67,8 @@ impl ProtocolAddress {
         debug!(target: "net", "ProtocolAddress::start() [END]");
     }
 
-    /// Handles receiving the address message. Loops to continually recieve address messages on the
-    /// address subsciption. Adds the recieved addresses to the list of hosts.
+    /// Handles receiving the address message. Loops to continually recieve address
+    /// messages on the address subsciption. Adds the recieved addresses to the list of hosts.
     async fn handle_receive_addrs(self: Arc<Self>) -> NetResult<()> {
         debug!(target: "net", "ProtocolAddress::handle_receive_addrs() [START]");
         loop {
@@ -86,8 +86,8 @@ impl ProtocolAddress {
         }
     }
 
-    /// Handles receiving the get-address message. Continually recieves get-address messages on the
-    /// get-address subsciption. Then replies with an address message.
+    /// Handles receiving the get-address message. Continually recieves get-address
+    /// messages on the get-address subsciption. Then replies with an address message.
     async fn handle_receive_get_addrs(self: Arc<Self>) -> NetResult<()> {
         debug!(target: "net", "ProtocolAddress::handle_receive_get_addrs() [START]");
         loop {

+ 2 - 2
src/net/protocols/protocol_jobs_manager.rs

@@ -41,8 +41,8 @@ impl ProtocolJobsManager {
         self.tasks.lock().await.push(executor.spawn(future))
     }
 
-    /// Waits for a stop signal, then closes all tasks. Insures that all tasks are stopped when a
-    /// channel closes. Called in start().
+    /// Waits for a stop signal, then closes all tasks. Insures that all tasks are
+    /// stopped when a channel closes. Called in start().
     async fn handle_stop(self: Arc<Self>) {
         let stop_sub = self.channel.clone().subscribe_stop().await;
 

+ 7 - 6
src/net/protocols/protocol_ping.rs

@@ -28,9 +28,9 @@ impl ProtocolPing {
         })
     }
 
-    /// Starts ping-pong keep-alive messages exchange. Runs ping-pong in the protocol task manager,
-    /// then queues the reply. run_ping_pong() sends out a ping and waits for pong reply.
-    /// reply_to_ping() waits for ping and replies with a pong.
+    /// Starts ping-pong keep-alive messages exchange. Runs ping-pong in the protocol
+    /// task manager, then queues the reply. Sends out a ping and waits for pong
+    /// reply. Waits for ping and replies with a pong.
     pub async fn start(self: Arc<Self>, executor: Arc<Executor<'_>>) {
         debug!(target: "net", "ProtocolPing::start() [START]");
         self.jobsman.clone().start(executor.clone());
@@ -45,9 +45,10 @@ impl ProtocolPing {
         debug!(target: "net", "ProtocolPing::start() [END]");
     }
 
-    /// Runs ping-pong protocol. Creates a subscription to pong, then starts a loop. Loop sleeps
-    /// for the duration of the channel heartbeat, then sends a ping message with a random nonce.
-    /// Loop starts a timer, waits for the pong reply and insures the nonce is the same.
+    /// Runs ping-pong protocol. Creates a subscription to pong, then starts a loop.
+    /// Loop sleeps for the duration of the channel heartbeat, then sends a ping
+    /// message with a random nonce. Loop starts a timer, waits for the pong reply
+    /// and insures the nonce is the same.
     async fn run_ping_pong(self: Arc<Self>) -> NetResult<()> {
         debug!(target: "net", "ProtocolPing::run_ping_pong() [START]");
         // Creates a subscription to pong message.

+ 7 - 6
src/net/protocols/protocol_seed.rs

@@ -6,8 +6,8 @@ use crate::net::error::NetResult;
 use crate::net::messages;
 use crate::net::{ChannelPtr, HostsPtr, SettingsPtr};
 
-/// Seed server protocol. Seed server is used when connecting to the network for the first time.
-/// Returns a list of IP addresses that nodes can connect to.
+/// Seed server protocol. Seed server is used when connecting to the network for
+/// the first time. Returns a list of IP addresses that nodes can connect to.
 pub struct ProtocolSeed {
     channel: ChannelPtr,
     hosts: HostsPtr,
@@ -24,8 +24,9 @@ impl ProtocolSeed {
         })
     }
 
-    /// Starts the seed protocol. Creates a subscription to the address message, then sends our
-    /// address to the seed server. Sends a get-address message and receives an address message.
+    /// Starts the seed protocol. Creates a subscription to the address message, then
+    /// sends our address to the seed server. Sends a get-address message and receives
+    /// an address message.
     pub async fn start(self: Arc<Self>, _executor: Arc<Executor<'_>>) -> NetResult<()> {
         debug!(target: "net", "ProtocolSeed::start() [START]");
         // Create a subscription to address message.
@@ -52,8 +53,8 @@ impl ProtocolSeed {
         Ok(())
     }
 
-    /// Sends own external address over a channel. Imports own external address from settings, then
-    /// adds that address to an address message and sends it out over the channel.
+    /// Sends own external address over a channel. Imports own external address from
+    /// settings, then adds that address to an address message and sends it out over the channel.
     pub async fn send_self_address(&self) -> NetResult<()> {
         match self.settings.external_addr {
             Some(addr) => {

+ 4 - 4
src/net/protocols/protocol_version.rs

@@ -18,8 +18,8 @@ pub struct ProtocolVersion {
 }
 
 impl ProtocolVersion {
-    /// Create a new version protocol. Makes a version and version acknowledgement subscription,
-    /// then adds them to a version protocol instance.
+    /// Create a new version protocol. Makes a version and version acknowledgement
+    /// subscription, then adds them to a version protocol instance.
     pub async fn new(channel: ChannelPtr, settings: SettingsPtr) -> Arc<Self> {
         // Creates a version subscription.
         let version_sub = channel
@@ -42,8 +42,8 @@ impl ProtocolVersion {
             settings,
         })
     }
-    /// Start version information exchange. Start the timer. Send version info and wait for version
-    /// acknowledgement. Wait for version info and send version acknowledgement.
+    /// Start version information exchange. Start the timer. Send version info and
+    /// wait for version acknowledgement. Wait for version info and send version acknowledgement.
     pub async fn run(self: Arc<Self>, executor: Arc<Executor<'_>>) -> NetResult<()> {
         debug!(target: "net", "ProtocolVersion::run() [START]");
         // Start timer