Correct listening addresses and associated log

This commit is contained in:
Age Manning
2019-03-17 14:25:47 +11:00
parent 7b6a653d05
commit 2871ad5055
3 changed files with 8 additions and 1 deletions

View File

@@ -7,6 +7,7 @@ use std::fs;
use std::net::IpAddr;
use std::net::SocketAddr;
use std::path::PathBuf;
use types::multiaddr::Protocol;
use types::multiaddr::ToMultiaddr;
use types::ChainSpec;
@@ -62,6 +63,11 @@ impl ClientConfig {
if let Some(port_str) = args.value_of("port") {
if let Ok(port) = port_str.parse::<u16>() {
config.net_conf.listen_port = port;
// update the listening multiaddrs
for address in &mut config.net_conf.listen_addresses {
address.pop();
address.append(Protocol::Tcp(port));
}
} else {
error!(log, "Invalid port"; "port" => port_str);
return Err("Invalid port");