Merge branch 'master' into ethminer_crate

Conflicts:
	ethcore/src/client.rs
	parity/main.rs
	rpc/src/v1/impls/eth.rs
	sync/src/chain.rs
This commit is contained in:
Tomasz Drwięga
2016-03-10 16:18:33 +01:00
9 changed files with 59 additions and 44 deletions

View File

@@ -93,6 +93,12 @@ impl Default for SyncConfig {
}
}
/// Current sync status
pub trait SyncStatusProvider: Send + Sync {
/// Get sync status
fn status(&self) -> SyncStatus;
}
/// Ethereum network protocol handler
pub struct EthSync {
/// Shared blockchain client. TODO: this should evetually become an IPC endpoint
@@ -114,11 +120,6 @@ impl EthSync {
sync
}
/// Get sync status
pub fn status(&self) -> SyncStatus {
self.sync.read().unwrap().status()
}
/// Stop sync
pub fn stop(&mut self, io: &mut NetworkContext<SyncMessage>) {
self.sync.write().unwrap().abort(&mut NetSyncIo::new(io, self.chain.deref()));
@@ -128,6 +129,14 @@ impl EthSync {
pub fn restart(&mut self, io: &mut NetworkContext<SyncMessage>) {
self.sync.write().unwrap().restart(&mut NetSyncIo::new(io, self.chain.deref()));
}
}
impl SyncStatusProvider for EthSync {
/// Get sync status
fn status(&self) -> SyncStatus {
self.sync.read().unwrap().status()
}
}
impl NetworkProtocolHandler<SyncMessage> for EthSync {