Skip to content

Commit

Permalink
fix: always canonicalize the SocketAddr
Browse files Browse the repository at this point in the history
  • Loading branch information
“ramfox” committed Dec 14, 2024
1 parent 5877b55 commit 079e917
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions iroh-relay/src/quic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,10 +259,7 @@ impl QuicClient {
let mut observed_addr = res.expect("checked");
// if we've sent to an ipv4 address, but received an observed address
// that is ivp6 then the address is an [IPv4-Mapped IPv6 Addresses](https://doc.rust-lang.org/beta/std/net/struct.Ipv6Addr.html#ipv4-mapped-ipv6-addresses)
if server_addr.is_ipv4() && observed_addr.is_ipv6() {
observed_addr =
SocketAddr::new(observed_addr.ip().to_canonical(), observed_addr.port());
}
observed_addr = SocketAddr::new(observed_addr.ip().to_canonical(), observed_addr.port());
let latency = conn.rtt() / 2;
// gracefully close the connections
conn.close(QUIC_ADDR_DISC_CLOSE_CODE, QUIC_ADDR_DISC_CLOSE_REASON);
Expand Down

0 comments on commit 079e917

Please sign in to comment.