Shutdown the Snapshot Service early (#8658)

* Shutdown the Snapshot Service when shutting down the runner

* Rename `service` to `client_service`

* Fix tests
This commit is contained in:
Nicolas Gotchac
2018-05-29 12:23:15 +02:00
committed by Andronik Ordian
parent 68d16b723a
commit 7fcb082cad
6 changed files with 25 additions and 3 deletions

View File

@@ -743,6 +743,10 @@ impl SnapshotService for Service {
trace!("Error sending snapshot service message: {:?}", e);
}
}
fn shutdown(&self) {
self.abort_restore();
}
}
impl Drop for Service {

View File

@@ -54,4 +54,7 @@ pub trait SnapshotService : Sync + Send {
/// Feed a raw block chunk to the service to be processed asynchronously.
/// no-op if currently restoring.
fn restore_block_chunk(&self, hash: H256, chunk: Bytes);
/// Shutdown the Snapshot Service by aborting any ongoing restore
fn shutdown(&self);
}