Explorar el Código

net: remove `advertise` bool from settings

instead use the presence of an external addresses to decide whether or
not our address should be broadcasted.
lunar-mining hace 2 años
padre
commit
949f9f0f6f

+ 0 - 6
src/net/protocol/protocol_address.rs

@@ -179,12 +179,6 @@ impl ProtocolAddress {
             return Ok(())
         }
 
-        // Do nothing if advertise is set to false
-        if !self.settings.advertise {
-            debug!(target: "net::protocol_address::send_my_addrs()", "Advertise is false. Stopping");
-            return Ok(())
-        }
-
         debug!(
             target: "net::protocol_address::send_my_addrs()",
             "[START] address={}", self.channel.address(),

+ 0 - 7
src/net/protocol/protocol_seed.rs

@@ -71,13 +71,6 @@ impl ProtocolSeed {
             return Ok(())
         }
 
-        // Do nothing if advertise is set to false
-        if !self.settings.advertise {
-            debug!(target: "net::protocol_seed::send_my_addrs()",
-            "Advertise is set to false. Stopping");
-            return Ok(())
-        }
-
         let mut addrs = vec![];
         for addr in self.settings.external_addrs.clone() {
             debug!(target: "net::protocol_seed::send_my_addrs()", "Attempting to ping self");

+ 0 - 9
src/net/settings.rs

@@ -68,8 +68,6 @@ pub struct Settings {
     pub outbound_peer_discovery_cooloff_time: u64,
     /// Time between peer discovery attempts
     pub outbound_peer_discovery_attempt_time: u64,
-    /// Advertise our external address
-    pub advertise: bool,
     /// Hostlist storage path
     pub hostlist: String,
     /// Pause interval within greylist refinery process
@@ -104,7 +102,6 @@ impl Default for Settings {
             hosts_quarantine_limit: 50,
             outbound_peer_discovery_cooloff_time: 30,
             outbound_peer_discovery_attempt_time: 5,
-            advertise: true,
             hostlist: "/dev/null".to_string(),
             greylist_refinery_interval: 5,
             white_connection_percent: 90,
@@ -198,11 +195,6 @@ pub struct SettingsOpt {
     #[structopt(skip)]
     pub outbound_peer_discovery_attempt_time: Option<u64>,
 
-    /// Advertise our external address
-    #[serde(default)]
-    #[structopt(long)]
-    pub advertise: bool,
-
     /// Hosts .tsv file to use
     #[serde(default)]
     #[structopt(long)]
@@ -256,7 +248,6 @@ impl From<SettingsOpt> for Settings {
             outbound_peer_discovery_attempt_time: opt
                 .outbound_peer_discovery_attempt_time
                 .unwrap_or(def.outbound_peer_discovery_attempt_time),
-            advertise: opt.advertise,
             hostlist: opt.hostlist.unwrap_or(def.hostlist),
             greylist_refinery_interval: opt
                 .greylist_refinery_interval