Skip to content

Commit

Permalink
Disable mDNS when passing --dev (paritytech#2467)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaka authored and MTDK1 committed Jul 10, 2019
1 parent d3d110a commit 0f3b913
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions core/cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ fn fill_network_configuration(
chain_spec_id: &str,
config: &mut NetworkConfiguration,
client_id: String,
is_dev: bool,
) -> error::Result<()> {
config.boot_nodes.extend(cli.bootnodes.into_iter());
config.config_path = Some(
Expand Down Expand Up @@ -359,7 +360,7 @@ fn fill_network_configuration(
config.in_peers = cli.in_peers;
config.out_peers = cli.out_peers;

config.enable_mdns = !cli.no_mdns;
config.enable_mdns = !is_dev && !cli.no_mdns;

Ok(())
}
Expand Down Expand Up @@ -441,13 +442,16 @@ where
config.roles = role;
config.disable_grandpa = cli.no_grandpa;

let is_dev = cli.shared_params.dev;

let client_id = config.client_id();
fill_network_configuration(
cli.network_config,
&base_path,
spec.id(),
&mut config.network,
client_id,
is_dev,
)?;

fill_transaction_pool_configuration::<F>(
Expand Down Expand Up @@ -476,7 +480,6 @@ where
config.rpc_ws = Some(
parse_address(&format!("{}:{}", ws_interface, 9944), cli.ws_port)?
);
let is_dev = cli.shared_params.dev;
config.rpc_cors = cli.rpc_cors.unwrap_or_else(|| if is_dev {
log::warn!("Running in --dev mode, RPC CORS has been disabled.");
None
Expand Down
2 changes: 1 addition & 1 deletion core/cli/src/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ pub struct NetworkConfigurationParams {
pub in_peers: u32,

/// By default, the network will use mDNS to discover other nodes on the local network. This
/// disables it.
/// disables it. Automatically implied when using --dev.
#[structopt(long = "no-mdns")]
pub no_mdns: bool,

Expand Down

0 comments on commit 0f3b913

Please sign in to comment.