Switch out .X().unwrap() for .unwrapped_X

This commit is contained in:
Gav Wood
2016-07-07 09:37:31 +02:00
parent 456ad9e21b
commit 3b662c285f
31 changed files with 335 additions and 311 deletions

View File

@@ -20,19 +20,18 @@
#![allow(dead_code)]
#![cfg_attr(feature="dev", allow(used_underscore_binding))]
pub mod service;
/// Default value for hypervisor ipc listener
pub const HYPERVISOR_IPC_URL: &'static str = "ipc:///tmp/parity-internal-hyper-status.ipc";
use nanoipc;
use std::sync::{Arc,RwLock};
use hypervisor::service::*;
use std::process::{Command,Child};
use std::collections::HashMap;
type BinaryId = &'static str;
pub mod service;
/// Default value for hypervisor ipc listener
pub const HYPERVISOR_IPC_URL: &'static str = "ipc:///tmp/parity-internal-hyper-status.ipc";
type BinaryId = &'static str;
const BLOCKCHAIN_DB_BINARY: BinaryId = "blockchain";
pub struct Hypervisor {

View File

@@ -22,7 +22,7 @@ use std::time::{Instant, Duration};
use std::sync::RwLock;
use std::ops::{Deref, DerefMut};
use ethsync::{EthSync, SyncProvider};
use util::Uint;
use util::{Uint, RwLockable};
use ethcore::client::*;
use number_prefix::{binary_prefix, Standalone, Prefixed};
@@ -77,18 +77,18 @@ impl Informant {
#[cfg_attr(feature="dev", allow(match_bool))]
pub fn tick(&self, client: &Client, maybe_sync: Option<&EthSync>) {
let elapsed = self.last_tick.read().unwrap().elapsed();
let elapsed = self.last_tick.unwrapped_read().elapsed();
if elapsed < Duration::from_secs(5) {
return;
}
*self.last_tick.write().unwrap() = Instant::now();
*self.last_tick.unwrapped_write() = Instant::now();
let chain_info = client.chain_info();
let queue_info = client.queue_info();
let cache_info = client.blockchain_cache_info();
let mut write_report = self.report.write().unwrap();
let mut write_report = self.report.unwrapped_write();
let report = client.report();
let paint = |c: Style, t: String| match self.with_color {
@@ -97,8 +97,8 @@ impl Informant {
};
if let (_, _, &Some(ref last_report)) = (
self.chain_info.read().unwrap().deref(),
self.cache_info.read().unwrap().deref(),
self.chain_info.unwrapped_read().deref(),
self.cache_info.unwrapped_read().deref(),
write_report.deref()
) {
println!("{} {} {} blk/s {} tx/s {} Mgas/s {}{}+{} Qed {} db {} chain {} queue{}",
@@ -137,8 +137,8 @@ impl Informant {
);
}
*self.chain_info.write().unwrap().deref_mut() = Some(chain_info);
*self.cache_info.write().unwrap().deref_mut() = Some(cache_info);
*self.chain_info.unwrapped_write().deref_mut() = Some(chain_info);
*self.cache_info.unwrapped_write().deref_mut() = Some(cache_info);
*write_report.deref_mut() = Some(report);
}
}