Fixing possible race condition in ethcore_hashContent (#3191)
This commit is contained in:
parent
caab72394d
commit
145e766db2
@ -302,7 +302,9 @@ impl<C, M, S: ?Sized, F> Ethcore for EthcoreClient<C, M, S, F> where
|
|||||||
.map(Into::into);
|
.map(Into::into);
|
||||||
|
|
||||||
// Receive ready and invoke with result.
|
// Receive ready and invoke with result.
|
||||||
let ready: Ready<H256> = rx.try_recv().expect("When on_done is invoked ready object is always sent.");
|
let ready: Ready<H256> = rx.recv().expect(
|
||||||
|
"recv() fails when `tx` has been dropped, if this closure is invoked `tx` is not dropped (`res == Ok()`); qed"
|
||||||
|
);
|
||||||
ready.ready(result);
|
ready.ready(result);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@ -310,7 +312,9 @@ impl<C, M, S: ?Sized, F> Ethcore for EthcoreClient<C, M, S, F> where
|
|||||||
if let Err(e) = res {
|
if let Err(e) = res {
|
||||||
ready.ready(Err(errors::from_fetch_error(e)));
|
ready.ready(Err(errors::from_fetch_error(e)));
|
||||||
} else {
|
} else {
|
||||||
tx.send(ready).expect("Rx end is sent to on_done closure.");
|
tx.send(ready).expect(
|
||||||
|
"send() fails when `rx` end is dropped, if `res == Ok()`: `rx` is moved to the closure; qed"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user