Browse Source

add default settings in net/

narodnik 5 years ago
parent
commit
bea00aeb9a
2 changed files with 18 additions and 4 deletions
  1. 1 4
      src/bin/dfi.rs
  2. 17 0
      src/net/settings.rs

+ 1 - 4
src/bin/dfi.rs

@@ -320,13 +320,10 @@ impl ProgramOptions {
             network_settings: net::Settings {
                 inbound: accept_addr,
                 outbound_connections: connection_slots,
-                seed_query_timeout_seconds: 8,
-                connect_timeout_seconds: 10,
-                channel_handshake_seconds: 4,
-                channel_heartbeat_seconds: 10,
                 external_addr: accept_addr,
                 peers: manual_connects,
                 seeds: seed_addrs,
+                ..Default::default()
             },
             log_path,
             rpc_port,

+ 17 - 0
src/net/settings.rs

@@ -19,3 +19,20 @@ pub struct Settings {
     pub peers: Vec<SocketAddr>,
     pub seeds: Vec<SocketAddr>,
 }
+
+impl Default for Settings {
+    fn default() -> Self {
+        Self {
+            inbound: None,
+            outbound_connections: 0,
+            seed_query_timeout_seconds: 8,
+            connect_timeout_seconds: 10,
+            channel_handshake_seconds: 4,
+            channel_heartbeat_seconds: 10,
+            external_addr: None,
+            peers: Vec::new(),
+            seeds: Vec::new(),
+        }
+    }
+}
+