Skip to content

Commit

Permalink
fix(manager): store node port inside during start
Browse files Browse the repository at this point in the history
  • Loading branch information
RolandSherwin authored and joshuef committed Jun 10, 2024
1 parent 29c8453 commit 5d67202
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion sn_service_management/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,27 @@ impl<'a> ServiceStateActions for NodeService<'a> {
self.service_data.listen_addr = Some(
network_info
.listeners
.into_iter()
.iter()
.cloned()
.map(|addr| addr.with(Protocol::P2p(node_info.peer_id)))
.collect(),
);

for addr in &network_info.listeners {
if let Some(port) = get_port_from_multiaddr(addr) {
debug!(
"Found safenode port for {}: {port}",
self.service_data.service_name
);
self.service_data.node_port = Some(port);
break;
}
}

if self.service_data.node_port.is_none() {
error!("Could not find safenode port. This will cause the node to have a different port during upgrade");
}

self.service_data.pid = Some(node_info.pid);
self.service_data.peer_id = Some(node_info.peer_id);
self.service_data.status = ServiceStatus::Running;
Expand Down

0 comments on commit 5d67202

Please sign in to comment.