mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 01:41:09 +00:00
Update networking code to libp2p 0.14 (#4383)
* Entirely update substrate-telemetry to futures 0.3 * Add a Closed error * Update to libp2p 0.14 * More work * More work * More work * More work * Fix warnings * Remove unwrap() * Work on tests fixing * Fix network tests * Fix external network tests * Update libp2p and restore Yamux in discovery test * Ignore DNS if initializatio nfails * Restore variables ordering * Forgot browser-utils * Fix downfall after merge * Fix tests
This commit is contained in:
committed by
Gavin Wood
parent
6e572a9477
commit
ca997cf1e4
@@ -71,7 +71,11 @@ pub fn build_transport(
|
||||
let desktop_trans = tcp::TcpConfig::new();
|
||||
let desktop_trans = websocket::WsConfig::new(desktop_trans.clone())
|
||||
.or_transport(desktop_trans);
|
||||
OptionalTransport::some(dns::DnsConfig::new(desktop_trans))
|
||||
OptionalTransport::some(if let Ok(dns) = dns::DnsConfig::new(desktop_trans.clone()) {
|
||||
dns.boxed()
|
||||
} else {
|
||||
desktop_trans.map_err(dns::DnsErr::Underlying).boxed()
|
||||
})
|
||||
} else {
|
||||
OptionalTransport::none()
|
||||
});
|
||||
@@ -91,7 +95,7 @@ pub fn build_transport(
|
||||
let transport = transport.and_then(move |stream, endpoint| {
|
||||
let upgrade = core::upgrade::SelectUpgrade::new(noise_config, secio_config);
|
||||
core::upgrade::apply(stream, upgrade, endpoint, upgrade::Version::V1)
|
||||
.and_then(|out| match out {
|
||||
.map(|out| match out? {
|
||||
// We negotiated noise
|
||||
EitherOutput::First((remote_id, out)) => {
|
||||
let remote_key = match remote_id {
|
||||
@@ -110,7 +114,7 @@ pub fn build_transport(
|
||||
#[cfg(target_os = "unknown")]
|
||||
let transport = transport.and_then(move |stream, endpoint| {
|
||||
core::upgrade::apply(stream, secio_config, endpoint, upgrade::Version::V1)
|
||||
.and_then(|(id, stream)| Ok((stream, id)))
|
||||
.map_ok(|(id, stream)| ((stream, id)))
|
||||
});
|
||||
|
||||
// Multiplexing
|
||||
@@ -121,7 +125,7 @@ pub fn build_transport(
|
||||
.map_outbound(move |muxer| (peer_id2, muxer));
|
||||
|
||||
core::upgrade::apply(stream, upgrade, endpoint, upgrade::Version::V1)
|
||||
.map(|(id, muxer)| (id, core::muxing::StreamMuxerBox::new(muxer)))
|
||||
.map_ok(|(id, muxer)| (id, core::muxing::StreamMuxerBox::new(muxer)))
|
||||
})
|
||||
|
||||
.timeout(Duration::from_secs(20))
|
||||
|
||||
Reference in New Issue
Block a user