aggstam 4 лет назад
Родитель
Сommit
09c23315f5

+ 1 - 1
script/research/fud/localnet/lilith_config.toml

@@ -7,7 +7,7 @@
 ## uncommenting, or by using the command-line.
 
 # Daemon published url, common for all enabled networks
-url = "tls://127.0.0.1"
+url = ["tls://127.0.0.1"]
 
 ## Per-network settings
 #[network."darkfid_sync"]

+ 1 - 1
src/net/protocol/protocol_seed.rs

@@ -41,7 +41,7 @@ impl ProtocolSeed {
     /// from settings, then adds that addresses to an address message and
     /// sends it out over the channel.
     pub async fn send_self_address(&self) -> Result<()> {
-        // Do nothing if external address is not configured
+        // Do nothing if external addresses are not configured
         if self.settings.external_addr.is_empty() {
             return Ok(())
         }

+ 3 - 1
src/net/session/inbound_session.rs

@@ -63,7 +63,7 @@ impl InboundSession {
             return Ok(())
         }
 
-        // Activate mutex lock on connection slots.
+        // Activate mutex lock on accept tasks.
         let mut accept_tasks = self.accept_tasks.lock().await;
 
         for (index, accept_addr) in self.p2p().settings().inbound.iter().enumerate() {
@@ -85,6 +85,7 @@ impl InboundSession {
 
         Ok(())
     }
+
     /// Stops the inbound session.
     pub async fn stop(&self) {
         self.acceptor.stop().await;
@@ -94,6 +95,7 @@ impl InboundSession {
             accept_task.stop().await;
         }
     }
+
     /// Start accepting connections for inbound session.
     async fn start_accept_session(
         self: Arc<Self>,

+ 1 - 13
src/net/session/outbound_session.rs

@@ -217,7 +217,7 @@ impl OutboundSession {
                     continue
                 }
 
-                if Self::is_self_inbound(&addr, &self_inbound_addr) {
+                if self_inbound_addr.contains(&addr) {
                     continue
                 }
 
@@ -229,18 +229,6 @@ impl OutboundSession {
             async_util::sleep(p2p.settings().outbound_retry_seconds).await;
         }
     }
-
-    /// Checks whether an address is in our own inbound addresses to avoid connecting
-    /// to ourselves.
-    fn is_self_inbound(addr: &Url, inbound_addr: &Vec<Url>) -> bool {
-        for ext_addr in inbound_addr {
-            if ext_addr == addr {
-                return true
-            }
-        }
-        // No inbound listening address configured
-        false
-    }
 }
 
 #[async_trait]

+ 1 - 1
src/net/session/seedsync_session.rs

@@ -37,7 +37,7 @@ impl SeedSyncSession {
 
         if settings.seeds.is_empty() {
             warn!("Skipping seed sync process since no seeds are configured.");
-            // Store external address in hosts explicitly
+            // Store external addresses in hosts explicitly
             if !settings.external_addr.is_empty() {
                 self.p2p().hosts().store(settings.external_addr.clone()).await
             }

+ 2 - 2
src/net/settings.rs

@@ -48,7 +48,7 @@ impl Default for Settings {
 #[derive(Clone, Debug, Deserialize, StructOpt, StructOptToml)]
 #[structopt()]
 pub struct SettingsOpt {
-    /// P2P accept address
+    /// P2P accept addresses
     #[serde(default)]
     #[structopt(long = "accept")]
     pub inbound: Vec<Url>,
@@ -57,7 +57,7 @@ pub struct SettingsOpt {
     #[structopt(long = "slots")]
     pub outbound_connections: Option<u32>,
 
-    /// P2P external address
+    /// P2P external addresses
     #[serde(default)]
     #[structopt(long)]
     pub external_addr: Vec<Url>,