mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-10 05:17:59 +00:00
Introduce support for yamux (#388)
This commit is contained in:
committed by
Benjamin Kampmann
parent
e3268de487
commit
625918394a
Generated
+3
-3
@@ -2228,7 +2228,7 @@ dependencies = [
|
||||
"lazy_static 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.41 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2713,7 +2713,7 @@ dependencies = [
|
||||
"hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parking_lot 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.70 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_derive 1.0.70 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -3860,7 +3860,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
[[package]]
|
||||
name = "yamux"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/paritytech/yamux#b2104369a4f676e11d1fc86cfc33e9a68d21c4f3"
|
||||
source = "git+https://github.com/paritytech/yamux#99a40f41824e33ed52d94659f7c05feb324411fa"
|
||||
dependencies = [
|
||||
"bytes 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.?
|
||||
|
||||
use libp2p::{self, Transport, secio};
|
||||
use libp2p::{self, Transport, mplex, secio, yamux};
|
||||
use libp2p::core::{MuxedTransport, either, upgrade};
|
||||
use libp2p::transport_timeout::TransportTimeout;
|
||||
use std::time::Duration;
|
||||
@@ -52,7 +52,11 @@ pub fn build_transport(
|
||||
})
|
||||
// TODO: check that the public key matches what is reported by identify
|
||||
.map(|(socket, _key), _| socket)
|
||||
.with_upgrade(libp2p::mplex::MultiplexConfig::new())
|
||||
// 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(yamux::Config::default(), either::EitherOutput::Second),
|
||||
))
|
||||
.into_connection_reuse();
|
||||
|
||||
TransportTimeout::new(base, Duration::from_secs(20))
|
||||
|
||||
Reference in New Issue
Block a user