Skip to content

Commit

Permalink
authority_client: rewrite udp address to tcp
Browse files Browse the repository at this point in the history
  • Loading branch information
bmwill committed Jul 5, 2024
1 parent 9e2be6a commit ec8a29a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
14 changes: 14 additions & 0 deletions crates/mysten-network/src/multiaddr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,20 @@ impl Multiaddr {
}
None
}

pub fn rewrite_udp_to_tcp(&self) -> Self {
let mut new = Self::empty();

for component in self.iter() {
if let Protocol::Udp(port) = component {
new.push(Protocol::Tcp(port));
} else {
new.push(component);
}
}

new
}
}

impl std::fmt::Display for Multiaddr {
Expand Down
12 changes: 9 additions & 3 deletions crates/sui-core/src/authority_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,15 @@ pub fn make_network_authority_clients_with_network_config(
SuiError::from("Missing network metadata in CommitteeWithNetworkMetadata")
})?
.network_address;
let channel = network_config
.connect_lazy(address)
.map_err(|err| anyhow!(err.to_string()))?;
let address = address.rewrite_udp_to_tcp();
let channel = network_config.connect_lazy(&address).map_err(|e| {
tracing::error!(
address = %address,
name = %name,
"unable to create authority client: {e}"
);
anyhow!(err.to_string())
})?;
let client = NetworkAuthorityClient::new(channel);
authority_clients.insert(*name, client);
}
Expand Down

0 comments on commit ec8a29a

Please sign in to comment.