General multiplexing fixes (#408)

This commit is contained in:
Pierre Krieger
2018-07-23 15:58:48 +02:00
committed by Gav Wood
parent 8c5f774490
commit fcb30f4009
3 changed files with 114 additions and 152 deletions
@@ -11,7 +11,7 @@ bytes = "0.4"
error-chain = { version = "0.12", default-features = false }
fnv = "1.0"
futures = "0.1"
libp2p = { git = "https://github.com/tomaka/libp2p-rs", rev = "ccbb4361c299491b40e5ca95cfa6716ba31c485c", default-features = false, features = ["libp2p-secio", "libp2p-secio-secp256k1"] }
libp2p = { git = "https://github.com/tomaka/libp2p-rs", rev = "c537102bb39f3ec6590befbfe9094cf411387f77", default-features = false, features = ["libp2p-secio", "libp2p-secio-secp256k1"] }
ethcore-io = { git = "https://github.com/paritytech/parity.git" }
ethkey = { git = "https://github.com/paritytech/parity.git" }
ethereum-types = "0.3"
@@ -35,7 +35,7 @@ pub fn build_transport(
let mut plaintext = upgrade::toggleable(upgrade::PlainTextConfig);
match unencrypted_allowed {
UnencryptedAllowed::Allowed => (),//plaintext.disable(),
UnencryptedAllowed::Allowed => plaintext.disable(),
UnencryptedAllowed::Denied => (),
};
@@ -54,7 +54,7 @@ pub fn build_transport(
.map(|(socket, _key), _| socket)
// TODO: this `EitherOutput` thing shows that libp2p's API could be improved
.with_upgrade(upgrade::or(
upgrade::map(mplex::MultiplexConfig::new(), either::EitherOutput::First),
upgrade::map(mplex::MplexConfig::new(), either::EitherOutput::First),
upgrade::map(yamux::Config::default(), either::EitherOutput::Second),
))
.into_connection_reuse();