浏览代码

net: rename anchor[..] to gold[..]

We have already mostly made this change so it's just for consistency.
draoi 2 年之前
父节点
当前提交
1915b38f8e
共有 2 个文件被更改,包括 16 次插入16 次删除
  1. 10 10
      src/net/session/outbound_session.rs
  2. 6 6
      src/net/settings.rs

+ 10 - 10
src/net/session/outbound_session.rs

@@ -151,7 +151,7 @@ impl Session for OutboundSession {
 #[repr(u8)]
 #[derive(Clone, Debug)]
 enum SlotPreference {
-    /// Highest preference that corresponds to the `anchor_connect_count` and
+    /// Highest preference that corresponds to the `gold_connect_count` and
     /// `white_count_count` preferences configured in Settings.
     First = 0,
     /// Reduced preference in case we don't have sufficient hosts to satisfy
@@ -205,12 +205,12 @@ impl Slot {
     }
 
     /// Address selection algorithm that works as follows: up to
-    /// anchor_count, select from the anchorlist. Up to white_count,
+    /// gold_count, select from the goldlist. Up to white_count,
     /// select from the whitelist. For all other slots, select from
     /// the greylist (this is SlotPreference::First).
     ///
     /// If we didn't find an address with this selection logic, downgrade
-    /// SlotPreference to Second. Up to anchor_count, select from the
+    /// SlotPreference to Second. Up to gold_count, select from the
     /// whitelist, up until white_count, select from the greylist.
     ///
     /// If we still didn't find an address, downgrade SlotPreference to Last
@@ -228,7 +228,7 @@ impl Slot {
         let hosts = &self.p2p().hosts().container;
 
         let white_count = settings.white_connect_count;
-        let anchor_count = settings.anchor_connect_count;
+        let gold_count = settings.gold_connect_count;
 
         let transports = &settings.allowed_transports;
         let transport_mixing = settings.transport_mixing;
@@ -238,7 +238,7 @@ impl Slot {
 
         match preference {
             SlotPreference::First => {
-                if slot < anchor_count {
+                if slot < gold_count {
                     hosts.fetch(HostColor::Gold, transports, transport_mixing).await
                 } else if slot < white_count {
                     hosts.fetch(HostColor::White, transports, transport_mixing).await
@@ -247,7 +247,7 @@ impl Slot {
                 }
             }
             SlotPreference::Second => {
-                if slot < anchor_count {
+                if slot < gold_count {
                     hosts.fetch(HostColor::White, transports, transport_mixing).await
                 } else if slot < white_count {
                     hosts.fetch(HostColor::Grey, transports, transport_mixing).await
@@ -256,7 +256,7 @@ impl Slot {
                 }
             }
             SlotPreference::Last => {
-                if slot < anchor_count {
+                if slot < gold_count {
                     hosts.fetch(HostColor::Grey, transports, transport_mixing).await
                 } else {
                     vec![]
@@ -265,12 +265,12 @@ impl Slot {
         }
     }
 
-    // Fetch an address we can connect to acccording to the white and anchor connection counts
+    // Fetch an address we can connect to acccording to the white and gold connection counts
     // configured in Settings.
     async fn fetch_addrs(&self) -> Option<(Url, u64)> {
         let hosts = self.p2p().hosts();
 
-        // First select an addresses that match our white and anchor requirements configured in
+        // First select an addresses that match our white and gold requirements configured in
         // Settings.
         let addrs = self.fetch_addrs_with_preference(SlotPreference::First).await;
 
@@ -296,7 +296,7 @@ impl Slot {
         None
     }
 
-    // We first try to make connections to the addresses on our anchor list. We then find some
+    // We first try to make connections to the addresses on our gold list. We then find some
     // whitelist connections according to the whitelist percent default. Finally, any remaining
     // connections we make from the greylist.
     async fn run(self: Arc<Self>) -> Result<()> {

+ 6 - 6
src/net/settings.rs

@@ -72,8 +72,8 @@ pub struct Settings {
     pub self_handshake_interval: u64,
     /// Percent of connections to come from the whitelist
     pub white_connect_count: u32,
-    /// Number of anchorlist connections
-    pub anchor_connect_count: u32,
+    /// Number of goldlist connections
+    pub gold_connect_count: u32,
     /// Number of seconds with no connections after which refinery
     /// process is paused.
     pub time_with_no_connections: u64,
@@ -108,7 +108,7 @@ impl Default for Settings {
             greylist_refinery_interval: 15,
             self_handshake_interval: 600,
             white_connect_count: 90,
-            anchor_connect_count: 2,
+            gold_connect_count: 2,
             time_with_no_connections: 30,
             blacklist: vec![],
         }
@@ -209,9 +209,9 @@ pub struct SettingsOpt {
     #[structopt(skip)]
     pub white_connect_count: Option<u32>,
 
-    /// Number of anchorlist connections
+    /// Number of goldlist connections
     #[structopt(skip)]
-    pub anchor_connect_count: Option<u32>,
+    pub gold_connect_count: Option<u32>,
 
     /// Number of seconds with no connections after which refinery
     /// process is paused.
@@ -264,7 +264,7 @@ impl From<SettingsOpt> for Settings {
                 .self_handshake_interval
                 .unwrap_or(def.self_handshake_interval),
             white_connect_count: opt.white_connect_count.unwrap_or(def.white_connect_count),
-            anchor_connect_count: opt.anchor_connect_count.unwrap_or(def.anchor_connect_count),
+            gold_connect_count: opt.gold_connect_count.unwrap_or(def.gold_connect_count),
             time_with_no_connections: opt
                 .time_with_no_connections
                 .unwrap_or(def.time_with_no_connections),