Avoid ip_echo_server unwrap (#17445)

(cherry picked from commit 30b60a976b)

Co-authored-by: Michael Vines <mvines@gmail.com>
This commit is contained in:
mergify[bot]
2021-05-24 14:40:47 -06:00
committed by GitHub
parent dd2d119d2b
commit fa65107460

View File

@ -276,7 +276,7 @@ pub struct Validator {
poh_service: PohService,
tpu: Tpu,
tvu: Tvu,
ip_echo_server: solana_net_utils::IpEchoServer,
ip_echo_server: Option<solana_net_utils::IpEchoServer>,
}
// in the distant future, get rid of ::new()/exit() and use Result properly...
@ -591,7 +591,7 @@ impl Validator {
std::thread::park();
}
let ip_echo_server = solana_net_utils::ip_echo_server(node.sockets.ip_echo.unwrap());
let ip_echo_server = node.sockets.ip_echo.map(solana_net_utils::ip_echo_server);
let gossip_service = GossipService::new(
&cluster_info,
@ -887,7 +887,9 @@ impl Validator {
self.completed_data_sets_service
.join()
.expect("completed_data_sets_service");
self.ip_echo_server.shutdown_background();
if let Some(ip_echo_server) = self.ip_echo_server {
ip_echo_server.shutdown_background();
}
}
}