Change JsonRpc exit to use wait->close (#5566)

* Add wait-close-join pattern to rpc_service

* Create ValidatorExit struct
This commit is contained in:
carllin
2019-08-20 23:59:31 -07:00
committed by GitHub
parent 159e518671
commit bb558acdf0
4 changed files with 94 additions and 35 deletions

View File

@@ -257,8 +257,8 @@ impl LocalCluster {
cluster
}
pub fn exit(&self) {
for node in self.fullnodes.values() {
pub fn exit(&mut self) {
for node in self.fullnodes.values_mut() {
node.exit();
}
}
@@ -587,7 +587,7 @@ impl Cluster for LocalCluster {
fn restart_node(&mut self, pubkey: Pubkey) {
// Shut down the fullnode
let node = self.fullnodes.remove(&pubkey).unwrap();
let mut node = self.fullnodes.remove(&pubkey).unwrap();
node.exit();
node.join().unwrap();