Skip to content

Commit

Permalink
Fix port number.
Browse files Browse the repository at this point in the history
  • Loading branch information
dvc94ch committed Aug 13, 2020
1 parent 511e6f5 commit cf2e9da
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
18 changes: 10 additions & 8 deletions client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,8 @@ pub struct SubxtClientConfig<C: ChainSpec + 'static> {
pub chain_spec: C,
/// Role of the node.
pub role: Role,
/// Enable telemetry.
pub enable_telemetry: bool,
/// Enable telemetry on the given port.
pub telemetry: Option<u16>,
}

impl<C: ChainSpec + 'static> SubxtClientConfig<C> {
Expand All @@ -238,10 +238,12 @@ impl<C: ChainSpec + 'static> SubxtClientConfig<C> {
wasm_external_transport: None,
use_yamux_flow_control: true,
};
let telemetry_endpoints = if self.enable_telemetry {
let endpoints =
TelemetryEndpoints::new(vec![("/ip4/127.0.0.1/tcp/99000/ws".into(), 0)])
.expect("valid config; qed");
let telemetry_endpoints = if let Some(port) = self.telemetry {
let endpoints = TelemetryEndpoints::new(vec![(
format!("/ip4/127.0.0.1/tcp/{}/ws", port),
0,
)])
.expect("valid config; qed");
Some(endpoints)
} else {
None
Expand Down Expand Up @@ -356,7 +358,7 @@ mod tests {
keystore: KeystoreConfig::InMemory,
chain_spec,
role: Role::Light,
enable_telemetry: false,
telemetry: None,
};
let client = ClientBuilder::<NodeTemplateRuntime>::new()
.set_client(
Expand Down Expand Up @@ -389,7 +391,7 @@ mod tests {
keystore: KeystoreConfig::InMemory,
chain_spec: test_node::chain_spec::development_config().unwrap(),
role: Role::Authority(AccountKeyring::Alice),
enable_telemetry: false,
telemetry: None,
};
let client = ClientBuilder::<NodeTemplateRuntime>::new()
.set_client(
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ mod tests {
},
chain_spec: test_node::chain_spec::development_config().unwrap(),
role: Role::Authority(key),
enable_telemetry: false,
telemetry: None,
};
let client = ClientBuilder::new()
.set_client(
Expand Down

0 comments on commit cf2e9da

Please sign in to comment.