Revert "Revert "Revert removal of tokio_executor that causes tokio version mismatch panic"" (#685)

This reverts commit 938f411a9365e9c5fb16bfedb62aacac4403d063.
This commit is contained in:
Ashley
2019-12-11 16:33:47 +01:00
committed by Gavin Wood
parent 07d3e00660
commit 9f1ba9d0db
3 changed files with 8 additions and 8 deletions
+4 -8
View File
@@ -747,7 +747,7 @@ enum CreateProposalState<C: Send + Sync, TxPool> {
/// Represents the state when we switch from pending to fired.
Switching,
/// Block proposing has fired.
Fired(tokio::task::JoinHandle<Result<Block, Error>>),
Fired(tokio_executor::blocking::Blocking<Result<Block, Error>>),
}
/// Inner data of the create proposal.
@@ -893,22 +893,18 @@ impl<C, TxPool> Future for CreateProposal<C, TxPool> where
thus Switching will never be reachable here; qed"
),
CreateProposalState::Fired(mut future) => {
let ret = Pin::new(&mut future)
.poll(cx)
.map(|res| res.map_err(Error::Join).and_then(|res| res));
let ret = Pin::new(&mut future).poll(cx);
self.state = CreateProposalState::Fired(future);
return ret
},
};
// 2. propose
let mut future = tokio::task::spawn_blocking(move || {
let mut future = tokio_executor::blocking::run(move || {
let proposed_candidates = data.table.proposed_set();
data.propose_with(proposed_candidates)
});
let polled = Pin::new(&mut future)
.poll(cx)
.map(|res| res.map_err(Error::Join).and_then(|res| res));
let polled = Pin::new(&mut future).poll(cx);
self.state = CreateProposalState::Fired(future);
polled