Skip to content
This repository was archived by the owner on Nov 6, 2020. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions ethcore/src/engines/clique/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ pub struct Clique {
block_state_by_hash: RwLock<LruCache<H256, CliqueBlockState>>,
proposals: RwLock<HashMap<Address, VoteType>>,
signer: RwLock<Option<Box<EngineSigner>>>,
step_service: Option<Arc<StepService>>,
step_service: Option<StepService>,
}

#[cfg(test)]
Expand All @@ -181,7 +181,7 @@ pub struct Clique {
pub block_state_by_hash: RwLock<LruCache<H256, CliqueBlockState>>,
pub proposals: RwLock<HashMap<Address, VoteType>>,
pub signer: RwLock<Option<Box<EngineSigner>>>,
pub step_service: Option<Arc<StepService>>,
pub step_service: Option<StepService>,
}

impl Clique {
Expand Down Expand Up @@ -745,10 +745,10 @@ impl Engine<EthereumMachine> for Clique {
}

fn stop(&mut self) {
if let Some(mut s) = self.step_service.as_mut() {
Arc::get_mut(&mut s).map(|x| x.stop());
if let Some(step_service) = self.step_service.as_mut() {
step_service.stop();
} else {
warn!(target: "engine", "Stopping `CliqueStepService` failed requires mutable access");
warn!(target: "engine", "Attempted to stop StepService but it does nothing; no step service registered");
}
}

Expand Down
6 changes: 3 additions & 3 deletions ethcore/src/engines/clique/step_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub struct StepService {

impl StepService {
/// Start the `StepService`
pub fn start<M: Machine + 'static>(engine: Weak<Engine<M>>) -> Arc<Self> {
pub fn start<M: Machine + 'static>(engine: Weak<Engine<M>>) -> Self {
let shutdown = Arc::new(AtomicBool::new(false));
let s = shutdown.clone();

Expand Down Expand Up @@ -60,10 +60,10 @@ impl StepService {
trace!(target: "miner", "CliqueStepService: shutdown.");
}).expect("CliqueStepService thread failed");

Arc::new(StepService {
StepService {
shutdown: s,
thread: Some(thread),
})
}
}

/// Stop the `StepService`
Expand Down