Delete Service trait (#6921)

This commit is contained in:
Greg Fitzgerald
2019-11-13 11:12:09 -07:00
committed by GitHub
parent 4b1e9ada18
commit a3a830e1ab
35 changed files with 57 additions and 222 deletions

View File

@@ -12,7 +12,6 @@ use crate::{
rpc_pubsub_service::PubSubService,
rpc_service::JsonRpcService,
rpc_subscriptions::RpcSubscriptions,
service::Service,
sigverify,
storage_stage::StorageState,
tpu::Tpu,
@@ -408,6 +407,24 @@ impl Validator {
node.sockets.retransmit_sockets[0].local_addr().unwrap()
);
}
pub fn join(self) -> Result<()> {
self.poh_service.join()?;
drop(self.poh_recorder);
if let Some(rpc_service) = self.rpc_service {
rpc_service.join()?;
}
if let Some(rpc_pubsub_service) = self.rpc_pubsub_service {
rpc_pubsub_service.join()?;
}
self.gossip_service.join()?;
self.tpu.join()?;
self.tvu.join()?;
self.ip_echo_server.shutdown_now();
Ok(())
}
}
pub fn new_banks_from_blocktree(
@@ -480,28 +497,6 @@ pub fn new_banks_from_blocktree(
)
}
impl Service for Validator {
type JoinReturnType = ();
fn join(self) -> Result<()> {
self.poh_service.join()?;
drop(self.poh_recorder);
if let Some(rpc_service) = self.rpc_service {
rpc_service.join()?;
}
if let Some(rpc_pubsub_service) = self.rpc_pubsub_service {
rpc_pubsub_service.join()?;
}
self.gossip_service.join()?;
self.tpu.join()?;
self.tvu.join()?;
self.ip_echo_server.shutdown_now();
Ok(())
}
}
pub fn new_validator_for_tests() -> (Validator, ContactInfo, Keypair, PathBuf) {
use crate::genesis_utils::{create_genesis_config_with_leader, GenesisConfigInfo};