Fix and add info messages (#1552)

* Display information on journal database on startup.

* Minor restyling.

* Client handles the enode message to avoid repeats.

* Avoid unneeded copies *and* reduce code.

* Fix up typo.
This commit is contained in:
Gav Wood
2016-07-06 18:28:11 +02:00
committed by GitHub
parent 095e51c39c
commit cd7b046d80
8 changed files with 69 additions and 37 deletions

View File

@@ -119,6 +119,7 @@ pub struct Client {
liveness: AtomicBool,
io_channel: IoChannel<NetSyncMessage>,
queue_transactions: AtomicUsize,
previous_enode: Mutex<Option<String>>,
}
const HISTORY: u64 = 1200;
@@ -204,6 +205,7 @@ impl Client {
miner: miner,
io_channel: message_channel,
queue_transactions: AtomicUsize::new(0),
previous_enode: Mutex::new(None),
};
Ok(Arc::new(client))
}
@@ -559,6 +561,18 @@ impl Client {
}
}
}
/// Notify us that the network has been started.
pub fn network_started(&self, url: &String) {
let mut previous_enode = self.previous_enode.lock().unwrap();
if let Some(ref u) = *previous_enode {
if u == url {
return;
}
}
*previous_enode = Some(url.clone());
info!(target: "mode", "Public node URL: {}", url.apply(Colour::White.bold()));
}
}
impl BlockChainClient for Client {