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

doc: fix various hosts documentation

draoi 2 лет назад
Родитель
Сommit
10404a962e
3 измененных файлов с 14 добавлено и 16 удалено
  1. 3 2
      src/net/hosts/mod.rs
  2. 9 11
      src/net/hosts/store.rs
  3. 2 3
      src/net/protocol/protocol_address.rs

+ 3 - 2
src/net/hosts/mod.rs

@@ -47,8 +47,9 @@ pub mod refinery;
 ///
 ///
 /// `HostColor`: White hosts have been seen recently. Gold hosts we have been able to establish
 /// `HostColor`: White hosts have been seen recently. Gold hosts we have been able to establish
 ///  a connection to. Grey hosts are recently received hosts that are periodically refreshed
 ///  a connection to. Grey hosts are recently received hosts that are periodically refreshed
-///  using the greylist refinery. Black hosts are considerede hostile and are strictly avoided
-///  for the duration of the program.
+///  using the greylist refinery. Black hosts are considered hostile and are strictly avoided
+///  for the duration of the program. Dark hosts are hosts that do not match our transports, but
+///  that we continue to share with other peers. They are otherwise ignored.
 ///
 ///
 /// `HostState`: a set of mutually exclusive states that can be Insert, Refine, Connect, Suspend
 /// `HostState`: a set of mutually exclusive states that can be Insert, Refine, Connect, Suspend
 ///  or Connected. The state is `None` when the corresponding host has been removed from the
 ///  or Connected. The state is `None` when the corresponding host has been removed from the

+ 9 - 11
src/net/hosts/store.rs

@@ -60,16 +60,15 @@ pub type HostRegistry = RwLock<HashMap<Url, HostState>>;
 ///                +------+      +---------+
 ///                +------+      +---------+
 ///       +------> | move | ---> | suspend |
 ///       +------> | move | ---> | suspend |
 ///       |        +------+      +---------+
 ///       |        +------+      +---------+
-///       |           ^               |       +--------+
-///       |           |               |       | insert |
-///       |                           v       +--------+
-///  +---------+      |          +--------+        |
-///  | connect |      |          | refine |        |
+///       |           ^               |
+///       |           |               v        +--------+
+///  +---------+      |          +--------+    | insert |
+///  | connect |      |          | refine |    +--------+
 ///  +---------+      |          +--------+        |
 ///  +---------+      |          +--------+        |
 ///       |           v               |            v
 ///       |           v               |            v
-///       |     +-----------+         |        +------+
-///       +---> | connected | <-------+------> | None |
-///             +-----------+                  +------+
+///       |     +-----------+         |         +------+
+///       +---> | connected | <-------+-------> | None |
+///             +-----------+                   +------+
 ///                   |
 ///                   |
 ///                   v
 ///                   v
 ///                +------+
 ///                +------+
@@ -853,9 +852,8 @@ impl Hosts {
     // Loop through hosts selected by Outbound Session and see if any of them are
     // Loop through hosts selected by Outbound Session and see if any of them are
     // free to connect to.
     // free to connect to.
     pub async fn check_addrs(&self, hosts: Vec<(Url, u64)>) -> Option<(Url, u64)> {
     pub async fn check_addrs(&self, hosts: Vec<(Url, u64)>) -> Option<(Url, u64)> {
+        debug!(target: "net::hosts::check_addrs()", "Starting checks");
         for (host, last_seen) in hosts {
         for (host, last_seen) in hosts {
-            debug!(target: "net::hosts::check_addrs()", "Starting checks");
-
             // Print a warning if we are trying to connect to a seed node in
             // Print a warning if we are trying to connect to a seed node in
             // Outbound session. This shouldn't happen as we reject configured
             // Outbound session. This shouldn't happen as we reject configured
             // seed nodes from entering our hostlist in filter_addrs().
             // seed nodes from entering our hostlist in filter_addrs().
@@ -867,7 +865,7 @@ impl Hosts {
             }
             }
 
 
             if let Err(e) = self.try_register(host.clone(), HostState::Connect).await {
             if let Err(e) = self.try_register(host.clone(), HostState::Connect).await {
-                debug!(target: "net::hosts::check_addrs", "Skipping addr={}, err={}",
+                trace!(target: "net::hosts::check_addrs", "Skipping addr={}, err={}",
                        host.clone(), e);
                        host.clone(), e);
                 continue
                 continue
             }
             }

+ 2 - 3
src/net/protocol/protocol_address.rs

@@ -55,9 +55,8 @@ use crate::Result;
 /// even if they can't connect to them themselves.
 /// even if they can't connect to them themselves.
 ///
 ///
 /// 4. Finally, if there's still space available, fill the remaining vector
 /// 4. Finally, if there's still space available, fill the remaining vector
-/// space with greylist entries. This is necessary in case this node does
-/// not support the transports of the requesting node (non-supported
-/// transports are stored on the greylist).
+/// space with darklist entries. This is necessary to propagate transports
+/// that neither this node nor the receiving node support.
 pub struct ProtocolAddress {
 pub struct ProtocolAddress {
     channel: ChannelPtr,
     channel: ChannelPtr,
     addrs_sub: MessageSubscription<AddrsMessage>,
     addrs_sub: MessageSubscription<AddrsMessage>,