Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
join dns with another instance of WS transport
Secure Websocket transport needs unresolved addresses, so we join DNS transport with
yet another instance of Websocket transport.

Closes #12024
  • Loading branch information
melekes committed Jan 13, 2023
commit ae133bb803b8bf852b90bcafb9f88e1ff2718df3
15 changes: 9 additions & 6 deletions client/network/src/transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,20 @@ pub fn build_transport(
// Build the base layer of the transport.
let transport = if !memory_only {
let tcp_config = tcp::Config::new().nodelay(true);
let desktop_trans = tcp::tokio::Transport::new(tcp_config.clone());
let desktop_trans = websocket::WsConfig::new(desktop_trans)
let tcp_trans = tcp::tokio::Transport::new(tcp_config.clone());
let desktop_trans = websocket::WsConfig::new(tcp_trans)
.or_transport(tcp::tokio::Transport::new(tcp_config.clone()));
let dns_init = dns::TokioDnsConfig::system(desktop_trans);
EitherTransport::Left(if let Ok(dns) = dns_init {
EitherTransport::Left(dns)
// Secure Websocket transport needs unresolved addresses, so we join DNS transport with
// yet another instance of Websocket transport.
let tcp_trans = tcp::tokio::Transport::new(tcp_config.clone());
EitherTransport::Left(dns.or_transport(websocket::WsConfig::new(tcp_trans)))
} else {
let desktop_trans = tcp::tokio::Transport::new(tcp_config.clone());
let desktop_trans = websocket::WsConfig::new(desktop_trans)
let tcp_trans = tcp::tokio::Transport::new(tcp_config.clone());
let desktop_trans = websocket::WsConfig::new(tcp_trans)
.or_transport(tcp::tokio::Transport::new(tcp_config));
EitherTransport::Right(desktop_trans.map_err(dns::DnsErr::Transport))
EitherTransport::Right(desktop_trans)
})
} else {
EitherTransport::Right(OptionalTransport::some(
Expand Down