Doc for rpc_port configuration

This commit is contained in:
Tyera Eulberg 2018-09-21 10:19:08 -06:00 committed by Tyera Eulberg
parent e3b3701e13
commit ad4fef4f09
1 changed files with 6 additions and 5 deletions

View File

@ -248,11 +248,12 @@ impl Fullnode {
// TODO: this code assumes this node is the leader // TODO: this code assumes this node is the leader
let mut drone_addr = node.info.contact_info.tpu; let mut drone_addr = node.info.contact_info.tpu;
drone_addr.set_port(DRONE_PORT); drone_addr.set_port(DRONE_PORT);
let rpc_addr = if let Some(port) = rpc_port {
SocketAddr::new(IpAddr::V4(Ipv4Addr::from(0)), port) // Use custom RPC port, if provided (`Some(port)`)
} else { // RPC port may be any open port on the node
SocketAddr::new(IpAddr::V4(Ipv4Addr::from(0)), RPC_PORT) // If rpc_port == `None`, node will listen on the default RPC_PORT from Rpc module
}; // If rpc_port == `Some(0)`, node will dynamically choose any open port. Useful for tests.
let rpc_addr = SocketAddr::new(IpAddr::V4(Ipv4Addr::from(0)), rpc_port.unwrap_or(RPC_PORT));
let rpc_service = JsonRpcService::new( let rpc_service = JsonRpcService::new(
&bank, &bank,
node.info.contact_info.tpu, node.info.contact_info.tpu,