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, poh_service: PohService,
tpu: Tpu, tpu: Tpu,
tvu: Tvu, 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... // in the distant future, get rid of ::new()/exit() and use Result properly...
@ -591,7 +591,7 @@ impl Validator {
std::thread::park(); 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( let gossip_service = GossipService::new(
&cluster_info, &cluster_info,
@ -887,7 +887,9 @@ impl Validator {
self.completed_data_sets_service self.completed_data_sets_service
.join() .join()
.expect("completed_data_sets_service"); .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();
}
} }
} }