Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
bring oneshot into scope
  • Loading branch information
gterzian committed Feb 25, 2019
commit aebe8652251c5e8ded917255097fda4320f9570d
7 changes: 4 additions & 3 deletions network/src/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ use codec::Decode;

use futures::prelude::*;
use futures::sync::mpsc;
use futures::sync::oneshot;

use std::collections::HashMap;
use std::sync::Arc;
Expand Down Expand Up @@ -187,8 +188,8 @@ pub struct NetworkDown;

/// A future that resolves when a collation is received.
pub struct AwaitingCollation {
outer: ::futures::sync::oneshot::Receiver<::futures::sync::oneshot::Receiver<Collation>>,
inner: Option<::futures::sync::oneshot::Receiver<Collation>>
outer: oneshot::Receiver<::futures::sync::oneshot::Receiver<Collation>>,
inner: Option<oneshot::Receiver<Collation>>
}

impl Future for AwaitingCollation {
Expand Down Expand Up @@ -219,7 +220,7 @@ impl<P: ProvideRuntimeApi + Send + Sync + 'static, E: Clone> Collators for Conse
type Collation = AwaitingCollation;

fn collate(&self, parachain: ParaId, relay_parent: Hash) -> Self::Collation {
let (tx, rx) = ::futures::sync::oneshot::channel();
let (tx, rx) = oneshot::channel();
self.network.with_spec(move |spec, _| {
let collation = spec.await_collation(relay_parent, parachain);
let _ = tx.send(collation);
Expand Down
7 changes: 4 additions & 3 deletions network/src/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ use polkadot_primitives::parachain::{BlockData, Extrinsic, CandidateReceipt, Par

use codec::Encode;
use futures::prelude::*;
use futures::sync::oneshot;
use tokio::runtime::TaskExecutor;
use parking_lot::Mutex;

Expand Down Expand Up @@ -228,7 +229,7 @@ impl<P: ProvideRuntimeApi + Send> TableRouter for Router<P>
fn fetch_block_data(&self, candidate: &CandidateReceipt) -> BlockDataReceiver {
let parent_hash = self.parent_hash.clone();
let candidate = candidate.clone();
let (tx, rx) = ::futures::sync::oneshot::channel();
let (tx, rx) = oneshot::channel();
self.network.with_spec(move |spec, ctx| {
let inner_rx = spec.fetch_block_data(ctx, &candidate, parent_hash);
let _ = tx.send(inner_rx);
Expand All @@ -250,8 +251,8 @@ impl<P> Drop for Router<P> {

/// Receiver for block data.
pub struct BlockDataReceiver {
outer: ::futures::sync::oneshot::Receiver<::futures::sync::oneshot::Receiver<BlockData>>,
inner: Option<::futures::sync::oneshot::Receiver<BlockData>>
outer: oneshot::Receiver<oneshot::Receiver<BlockData>>,
inner: Option<oneshot::Receiver<BlockData>>
}

impl Future for BlockDataReceiver {
Expand Down