Browse Source

net: fix args conflicting by replacing p2p datastore arg to p2p_datastore

dasman 1 year ago
parent
commit
0cb128ebb9
5 changed files with 8 additions and 8 deletions
  1. 1 1
      bin/lilith/src/main.rs
  2. 1 1
      src/net/acceptor.rs
  3. 1 1
      src/net/connector.rs
  4. 1 1
      src/net/p2p.rs
  5. 4 4
      src/net/settings.rs

+ 1 - 1
bin/lilith/src/main.rs

@@ -353,7 +353,7 @@ async fn spawn_net(name: String, info: &NetInfo, ex: Arc<Executor<'static>>) ->
         inbound_connections: 512,
         app_version: info.version.clone(),
         localnet: info.localnet,
-        datastore: Some(info.datastore.clone()),
+        p2p_datastore: Some(info.datastore.clone()),
         hostlist: Some(info.hostlist.clone()),
         allowed_transports: vec![
             "tcp".to_string(),

+ 1 - 1
src/net/acceptor.rs

@@ -64,7 +64,7 @@ impl Acceptor {
     /// Start accepting inbound socket connections
     pub async fn start(self: Arc<Self>, endpoint: Url, ex: Arc<Executor<'_>>) -> Result<()> {
         let datastore =
-            self.session.upgrade().unwrap().p2p().settings().read().await.datastore.clone();
+            self.session.upgrade().unwrap().p2p().settings().read().await.p2p_datastore.clone();
 
         // Initialize listener
         let listener = Listener::new(endpoint.clone(), datastore).await?;

+ 1 - 1
src/net/connector.rs

@@ -65,7 +65,7 @@ impl Connector {
         let settings = self.settings.read().await;
         let transports = settings.allowed_transports.clone();
         let transport_mixing = settings.transport_mixing;
-        let datastore = settings.datastore.clone();
+        let datastore = settings.p2p_datastore.clone();
         let outbound_connect_timeout = settings.outbound_connect_timeout;
         drop(settings);
 

+ 1 - 1
src/net/p2p.rs

@@ -89,7 +89,7 @@ impl P2p {
     /// p2p parent class.
     pub async fn new(settings: Settings, executor: ExecutorPtr) -> Result<P2pPtr> {
         // Create the datastore
-        if let Some(ref datastore) = settings.datastore {
+        if let Some(ref datastore) = settings.p2p_datastore {
             let datastore = expand_path(datastore)?;
             fs::create_dir_all(&datastore).await?;
             fs::set_permissions(&datastore, PermissionsExt::from_mode(0o700)).await?;

+ 4 - 4
src/net/settings.rs

@@ -80,7 +80,7 @@ pub struct Settings {
     /// Time between peer discovery attempts
     pub outbound_peer_discovery_attempt_time: u64,
     /// P2P datastore path
-    pub datastore: Option<String>,
+    pub p2p_datastore: Option<String>,
     /// Hostlist storage path
     pub hostlist: Option<String>,
     /// Pause interval within greylist refinery process
@@ -128,7 +128,7 @@ impl Default for Settings {
             localnet: false,
             outbound_peer_discovery_cooloff_time: 30,
             outbound_peer_discovery_attempt_time: 5,
-            datastore: None,
+            p2p_datastore: None,
             hostlist: None,
             greylist_refinery_interval: 15,
             white_connect_percent: 70,
@@ -223,7 +223,7 @@ pub struct SettingsOpt {
     /// P2P datastore path
     #[serde(default)]
     #[structopt(long)]
-    pub datastore: Option<String>,
+    pub p2p_datastore: Option<String>,
 
     /// Hosts .tsv file to use
     #[serde(default)]
@@ -298,7 +298,7 @@ impl From<SettingsOpt> for Settings {
             outbound_peer_discovery_attempt_time: opt
                 .outbound_peer_discovery_attempt_time
                 .unwrap_or(def.outbound_peer_discovery_attempt_time),
-            datastore: opt.datastore,
+            p2p_datastore: opt.p2p_datastore,
             hostlist: opt.hostlist,
             greylist_refinery_interval: opt
                 .greylist_refinery_interval