mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-30 13:07:56 +00:00
Reduce the number of types in build_transport for transport (#9793)
This commit is contained in:
@@ -58,20 +58,16 @@ pub fn build_transport(
|
||||
let desktop_trans =
|
||||
websocket::WsConfig::new(desktop_trans.clone()).or_transport(desktop_trans);
|
||||
let dns_init = futures::executor::block_on(dns::DnsConfig::system(desktop_trans.clone()));
|
||||
OptionalTransport::some(if let Ok(dns) = dns_init {
|
||||
EitherTransport::Left(if let Ok(dns) = dns_init {
|
||||
EitherTransport::Left(dns)
|
||||
} else {
|
||||
EitherTransport::Right(desktop_trans.map_err(dns::DnsErr::Transport))
|
||||
})
|
||||
} else {
|
||||
// For the in-memory case we set up the transport with an `.or_transport` below.
|
||||
OptionalTransport::none()
|
||||
EitherTransport::Right(OptionalTransport::some(
|
||||
libp2p::core::transport::MemoryTransport::default(),
|
||||
))
|
||||
};
|
||||
let transport = transport.or_transport(if memory_only {
|
||||
OptionalTransport::some(libp2p::core::transport::MemoryTransport::default())
|
||||
} else {
|
||||
OptionalTransport::none()
|
||||
});
|
||||
|
||||
let (transport, bandwidth) = bandwidth::BandwidthLogging::new(transport);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user