Skip to content

Commit c349c43

Browse files
authored
refactor: display the socket addr and relay for a ConnectionType::Mixed (#2793)
## Description Each time a `ConnectionType::Mixed` has a different SocketAddr or RelayUrl, we correctly resend a `ConnectionType::Mixed` event to `Endpoint::conn_type_stream`. However, when we print those changes in something like `iroh doctor`, we only print the name of the connection type, we don't print the socket address or relay url, so it looke like we are sending extra `Mixed` events erroneously. Adding more details to the `Display` of `ConnectionType`, so that it prints the socket addrs and or relay urls. ## Change checklist - [x] Self-review.
1 parent 43f5fed commit c349c43

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

iroh-net/src/discovery/local_swarm_discovery.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
//! .iter()
2323
//! .any(|(source, duration)| {
2424
//! if let Source::Discovery { name } = source {
25-
//! name == iroh_net::discovery::local_swarm_discovery::NAME && *duration >= recent
25+
//! name == iroh_net::discovery::local_swarm_discovery::NAME && *duration <= recent
2626
//! } else {
2727
//! false
2828
//! }

iroh-net/src/magicsock/node_map/node_state.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1389,16 +1389,16 @@ impl RemoteInfo {
13891389
#[derive(derive_more::Display, Debug, Clone, Eq, PartialEq, Serialize, Deserialize)]
13901390
pub enum ConnectionType {
13911391
/// Direct UDP connection
1392-
#[display("direct")]
1392+
#[display("direct({_0})")]
13931393
Direct(SocketAddr),
13941394
/// Relay connection over relay
1395-
#[display("relay")]
1395+
#[display("relay({_0})")]
13961396
Relay(RelayUrl),
13971397
/// Both a UDP and a relay connection are used.
13981398
///
13991399
/// This is the case if we do have a UDP address, but are missing a recent confirmation that
14001400
/// the address works.
1401-
#[display("mixed")]
1401+
#[display("mixed(udp: {_0}, relay: {_1})")]
14021402
Mixed(SocketAddr, RelayUrl),
14031403
/// We have no verified connection to this PublicKey
14041404
#[display("none")]

0 commit comments

Comments
 (0)