removed panic handlers (#5895)
This commit is contained in:
@@ -21,7 +21,6 @@ use std::time::{Instant, Duration};
|
||||
use std::thread::sleep;
|
||||
use std::sync::Arc;
|
||||
use rustc_serialize::hex::FromHex;
|
||||
use io::{PanicHandler, ForwardPanic};
|
||||
use util::{ToPretty, U256, H256, Address, Hashable};
|
||||
use rlp::PayloadInfo;
|
||||
use ethcore::service::ClientService;
|
||||
@@ -148,9 +147,6 @@ pub fn execute(cmd: BlockchainCmd) -> Result<(), String> {
|
||||
fn execute_import(cmd: ImportBlockchain) -> Result<(), String> {
|
||||
let timer = Instant::now();
|
||||
|
||||
// Setup panic handler
|
||||
let panic_handler = PanicHandler::new_in_arc();
|
||||
|
||||
// load spec file
|
||||
let spec = cmd.spec.spec()?;
|
||||
|
||||
@@ -219,7 +215,6 @@ fn execute_import(cmd: ImportBlockchain) -> Result<(), String> {
|
||||
// free up the spec in memory.
|
||||
drop(spec);
|
||||
|
||||
panic_handler.forward_from(&service);
|
||||
let client = service.client();
|
||||
|
||||
let mut instream: Box<io::Read> = match cmd.file_path {
|
||||
@@ -390,7 +385,6 @@ fn start_client(
|
||||
}
|
||||
|
||||
fn execute_export(cmd: ExportBlockchain) -> Result<(), String> {
|
||||
// Setup panic handler
|
||||
let service = start_client(
|
||||
cmd.dirs,
|
||||
cmd.spec,
|
||||
@@ -403,10 +397,8 @@ fn execute_export(cmd: ExportBlockchain) -> Result<(), String> {
|
||||
cmd.wal,
|
||||
cmd.cache_config
|
||||
)?;
|
||||
let panic_handler = PanicHandler::new_in_arc();
|
||||
let format = cmd.format.unwrap_or_default();
|
||||
|
||||
panic_handler.forward_from(&service);
|
||||
let client = service.client();
|
||||
|
||||
let mut out: Box<io::Write> = match cmd.file_path {
|
||||
@@ -433,7 +425,6 @@ fn execute_export(cmd: ExportBlockchain) -> Result<(), String> {
|
||||
}
|
||||
|
||||
fn execute_export_state(cmd: ExportState) -> Result<(), String> {
|
||||
// Setup panic handler
|
||||
let service = start_client(
|
||||
cmd.dirs,
|
||||
cmd.spec,
|
||||
@@ -447,9 +438,6 @@ fn execute_export_state(cmd: ExportState) -> Result<(), String> {
|
||||
cmd.cache_config
|
||||
)?;
|
||||
|
||||
let panic_handler = PanicHandler::new_in_arc();
|
||||
|
||||
panic_handler.forward_from(&service);
|
||||
let client = service.client();
|
||||
|
||||
let mut out: Box<io::Write> = match cmd.file_path {
|
||||
|
||||
@@ -21,7 +21,6 @@ use fdlimit::raise_fd_limit;
|
||||
use parity_rpc::{NetworkSettings, informant, is_major_importing};
|
||||
use ethsync::NetworkConfiguration;
|
||||
use util::{Colour, version, Mutex, Condvar};
|
||||
use io::{MayPanic, ForwardPanic, PanicHandler};
|
||||
use ethcore_logger::{Config as LogConfig, RotatingLogger};
|
||||
use ethcore::miner::{StratumOptions, Stratum};
|
||||
use ethcore::client::{Client, Mode, DatabaseCompactionProfile, VMType, BlockChainClient};
|
||||
@@ -168,8 +167,6 @@ fn execute_light(cmd: RunCmd, can_restart: bool, logger: Arc<RotatingLogger>) ->
|
||||
use ethsync::{LightSyncParams, LightSync, ManageNetwork};
|
||||
use util::RwLock;
|
||||
|
||||
let panic_handler = PanicHandler::new_in_arc();
|
||||
|
||||
// load spec
|
||||
let spec = cmd.spec.spec()?;
|
||||
|
||||
@@ -332,7 +329,7 @@ fn execute_light(cmd: RunCmd, can_restart: bool, logger: Arc<RotatingLogger>) ->
|
||||
});
|
||||
|
||||
// wait for ctrl-c.
|
||||
Ok(wait_for_exit(panic_handler, None, None, can_restart))
|
||||
Ok(wait_for_exit(None, None, can_restart))
|
||||
}
|
||||
|
||||
pub fn execute(cmd: RunCmd, can_restart: bool, logger: Arc<RotatingLogger>) -> Result<(bool, Option<String>), String> {
|
||||
@@ -352,9 +349,6 @@ pub fn execute(cmd: RunCmd, can_restart: bool, logger: Arc<RotatingLogger>) -> R
|
||||
return execute_light(cmd, can_restart, logger);
|
||||
}
|
||||
|
||||
// set up panic handler
|
||||
let panic_handler = PanicHandler::new_in_arc();
|
||||
|
||||
// load spec
|
||||
let spec = cmd.spec.spec()?;
|
||||
|
||||
@@ -517,9 +511,6 @@ pub fn execute(cmd: RunCmd, can_restart: bool, logger: Arc<RotatingLogger>) -> R
|
||||
// drop the spec to free up genesis state.
|
||||
drop(spec);
|
||||
|
||||
// forward panics from service
|
||||
panic_handler.forward_from(&service);
|
||||
|
||||
// take handle to client
|
||||
let client = service.client();
|
||||
let snapshot_service = service.snapshot_service();
|
||||
@@ -731,7 +722,7 @@ pub fn execute(cmd: RunCmd, can_restart: bool, logger: Arc<RotatingLogger>) -> R
|
||||
}
|
||||
|
||||
// Handle exit
|
||||
let restart = wait_for_exit(panic_handler, Some(updater), Some(client), can_restart);
|
||||
let restart = wait_for_exit(Some(updater), Some(client), can_restart);
|
||||
|
||||
info!("Finishing work, please wait...");
|
||||
|
||||
@@ -836,7 +827,6 @@ fn build_create_account_hint(spec: &SpecType, keys: &str) -> String {
|
||||
}
|
||||
|
||||
fn wait_for_exit(
|
||||
panic_handler: Arc<PanicHandler>,
|
||||
updater: Option<Arc<Updater>>,
|
||||
client: Option<Arc<Client>>,
|
||||
can_restart: bool
|
||||
@@ -847,10 +837,6 @@ fn wait_for_exit(
|
||||
let e = exit.clone();
|
||||
CtrlC::set_handler(move || { e.1.notify_all(); });
|
||||
|
||||
// Handle panics
|
||||
let e = exit.clone();
|
||||
panic_handler.on_panic(move |_reason| { e.1.notify_all(); });
|
||||
|
||||
if can_restart {
|
||||
if let Some(updater) = updater {
|
||||
// Handle updater wanting to restart us
|
||||
|
||||
@@ -35,8 +35,6 @@ use dir::Directories;
|
||||
use user_defaults::UserDefaults;
|
||||
use fdlimit;
|
||||
|
||||
use io::PanicHandler;
|
||||
|
||||
/// Kinds of snapshot commands.
|
||||
#[derive(Debug, PartialEq, Clone, Copy)]
|
||||
pub enum Kind {
|
||||
@@ -133,10 +131,7 @@ fn restore_using<R: SnapshotReader>(snapshot: Arc<SnapshotService>, reader: &R,
|
||||
|
||||
impl SnapshotCommand {
|
||||
// shared portion of snapshot commands: start the client service
|
||||
fn start_service(self) -> Result<(ClientService, Arc<PanicHandler>), String> {
|
||||
// Setup panic handler
|
||||
let panic_handler = PanicHandler::new_in_arc();
|
||||
|
||||
fn start_service(self) -> Result<ClientService, String> {
|
||||
// load spec file
|
||||
let spec = self.spec.spec()?;
|
||||
|
||||
@@ -196,12 +191,12 @@ impl SnapshotCommand {
|
||||
Arc::new(Miner::with_spec(&spec))
|
||||
).map_err(|e| format!("Client service error: {:?}", e))?;
|
||||
|
||||
Ok((service, panic_handler))
|
||||
Ok(service)
|
||||
}
|
||||
/// restore from a snapshot
|
||||
pub fn restore(self) -> Result<(), String> {
|
||||
let file = self.file_path.clone();
|
||||
let (service, _panic_handler) = self.start_service()?;
|
||||
let service = self.start_service()?;
|
||||
|
||||
warn!("Snapshot restoration is experimental and the format may be subject to change.");
|
||||
warn!("On encountering an unexpected error, please ensure that you have a recent snapshot.");
|
||||
@@ -236,7 +231,7 @@ impl SnapshotCommand {
|
||||
let file_path = self.file_path.clone().ok_or("No file path provided.".to_owned())?;
|
||||
let file_path: PathBuf = file_path.into();
|
||||
let block_at = self.block_at;
|
||||
let (service, _panic_handler) = self.start_service()?;
|
||||
let service = self.start_service()?;
|
||||
|
||||
warn!("Snapshots are currently experimental. File formats may be subject to change.");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user