Skip to content

Commit

Permalink
Update multistream-select to stable futures (#1484)
Browse files Browse the repository at this point in the history
* Update multistream-select to stable futures

* Fix intradoc links
  • Loading branch information
tomaka authored Mar 11, 2020
1 parent 2084fad commit 31271fc
Show file tree
Hide file tree
Showing 11 changed files with 838 additions and 639 deletions.
2 changes: 1 addition & 1 deletion core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ bs58 = "0.3.0"
ed25519-dalek = "1.0.0-pre.3"
either = "1.5"
fnv = "1.0"
futures = { version = "0.3.1", features = ["compat", "io-compat", "executor", "thread-pool"] }
futures = { version = "0.3.1", features = ["executor", "thread-pool"] }
futures-timer = "3"
lazy_static = "1.2"
libsecp256k1 = { version = "0.3.1", optional = true }
Expand Down
2 changes: 1 addition & 1 deletion core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ mod keys_proto {

/// Multi-address re-export.
pub use multiaddr;
pub type Negotiated<T> = futures::compat::Compat01As03<multistream_select::Negotiated<futures::compat::Compat<T>>>;
pub type Negotiated<T> = multistream_select::Negotiated<T>;

mod peer_id;
mod translation;
Expand Down
14 changes: 7 additions & 7 deletions core/src/upgrade/apply.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

use crate::{ConnectedPoint, Negotiated};
use crate::upgrade::{InboundUpgrade, OutboundUpgrade, UpgradeError, ProtocolName};
use futures::{future::Either, prelude::*, compat::Compat, compat::Compat01As03, compat::Future01CompatExt};
use futures::{future::Either, prelude::*};
use log::debug;
use multistream_select::{self, DialerSelectFuture, ListenerSelectFuture};
use std::{iter, mem, pin::Pin, task::Context, task::Poll};
Expand Down Expand Up @@ -48,7 +48,7 @@ where
U: InboundUpgrade<Negotiated<C>>,
{
let iter = up.protocol_info().into_iter().map(NameWrap as fn(_) -> NameWrap<_>);
let future = multistream_select::listener_select_proto(Compat::new(conn), iter).compat();
let future = multistream_select::listener_select_proto(conn, iter);
InboundUpgradeApply {
inner: InboundUpgradeApplyState::Init { future, upgrade: up }
}
Expand All @@ -61,7 +61,7 @@ where
U: OutboundUpgrade<Negotiated<C>>
{
let iter = up.protocol_info().into_iter().map(NameWrap as fn(_) -> NameWrap<_>);
let future = multistream_select::dialer_select_proto(Compat::new(conn), iter, v).compat();
let future = multistream_select::dialer_select_proto(conn, iter, v);
OutboundUpgradeApply {
inner: OutboundUpgradeApplyState::Init { future, upgrade: up }
}
Expand All @@ -82,7 +82,7 @@ where
U: InboundUpgrade<Negotiated<C>>,
{
Init {
future: Compat01As03<ListenerSelectFuture<Compat<C>, NameWrap<U::Info>>>,
future: ListenerSelectFuture<C, NameWrap<U::Info>>,
upgrade: U,
},
Upgrade {
Expand Down Expand Up @@ -117,7 +117,7 @@ where
}
};
self.inner = InboundUpgradeApplyState::Upgrade {
future: Box::pin(upgrade.upgrade_inbound(Compat01As03::new(io), info.0))
future: Box::pin(upgrade.upgrade_inbound(io, info.0))
};
}
InboundUpgradeApplyState::Upgrade { mut future } => {
Expand Down Expand Up @@ -158,7 +158,7 @@ where
U: OutboundUpgrade<Negotiated<C>>
{
Init {
future: Compat01As03<DialerSelectFuture<Compat<C>, NameWrapIter<<U::InfoIter as IntoIterator>::IntoIter>>>,
future: DialerSelectFuture<C, NameWrapIter<<U::InfoIter as IntoIterator>::IntoIter>>,
upgrade: U
},
Upgrade {
Expand Down Expand Up @@ -193,7 +193,7 @@ where
}
};
self.inner = OutboundUpgradeApplyState::Upgrade {
future: Box::pin(upgrade.upgrade_outbound(Compat01As03::new(connection), info.0))
future: Box::pin(upgrade.upgrade_outbound(connection, info.0))
};
}
OutboundUpgradeApplyState::Upgrade { mut future } => {
Expand Down
10 changes: 5 additions & 5 deletions misc/multistream-select/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ edition = "2018"

[dependencies]
bytes = "0.5"
futures = "0.1"
futures = "0.3"
log = "0.4"
pin-project = "0.4.8"
smallvec = "1.0"
tokio-io = "0.1"
unsigned-varint = "0.3"
unsigned-varint = "0.3.2"

[dev-dependencies]
tokio = "0.1"
tokio-tcp = "0.1"
async-std = "1.2"
quickcheck = "0.9.0"
rand = "0.7.2"
rw-stream-sink = "0.2.1"
Loading

0 comments on commit 31271fc

Please sign in to comment.