Merge pull request #721 from ethcore/titi

Lock reports to avoid out of order badness.
This commit is contained in:
Arkadiy Paronyan 2016-03-14 17:26:01 +01:00
commit 683c13db37

View File

@ -608,13 +608,15 @@ impl Informant {
let chain_info = client.chain_info();
let queue_info = client.queue_info();
let cache_info = client.blockchain_cache_info();
let report = client.report();
let sync_info = sync.status();
let mut write_report = self.report.write().unwrap();
let report = client.report();
if let (_, _, &Some(ref last_report)) = (
self.chain_info.read().unwrap().deref(),
self.cache_info.read().unwrap().deref(),
self.report.read().unwrap().deref()
write_report.deref()
) {
println!("[ #{} {} ]---[ {} blk/s | {} tx/s | {} gas/s //··· {}/{} peers, #{}, {}+{} queued ···// mem: {} db, {} chain, {} queue, {} sync ]",
chain_info.best_block_number,
@ -638,7 +640,7 @@ impl Informant {
*self.chain_info.write().unwrap().deref_mut() = Some(chain_info);
*self.cache_info.write().unwrap().deref_mut() = Some(cache_info);
*self.report.write().unwrap().deref_mut() = Some(report);
*write_report.deref_mut() = Some(report);
}
}