Skip to content

Commit

Permalink
Log connection type changes
Browse files Browse the repository at this point in the history
  • Loading branch information
flub committed May 10, 2024
1 parent dadbeb0 commit d270d60
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions iroh-net/src/magicsock/node_map/node_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,21 +296,15 @@ impl NodeState {
(addr, self.relay_url())
}
};
match (best_addr, relay_url.clone()) {
(Some(best_addr), Some(relay_url)) => {
let _ = self
.conn_type
.update(ConnectionType::Mixed(best_addr, relay_url));
}
(Some(best_addr), None) => {
let _ = self.conn_type.update(ConnectionType::Direct(best_addr));
}
(None, Some(relay_url)) => {
let _ = self.conn_type.update(ConnectionType::Relay(relay_url));
}
(None, None) => {
let _ = self.conn_type.update(ConnectionType::None);
}
let typ = match (best_addr, relay_url.clone()) {
(Some(best_addr), Some(relay_url)) => ConnectionType::Mixed(best_addr, relay_url),
(Some(best_addr), None) => ConnectionType::Direct(best_addr),
(None, Some(relay_url)) => ConnectionType::Relay(relay_url),
(None, None) => ConnectionType::None,
};
if self.conn_type.update(typ).is_ok() {
let typ = self.conn_type.get();
info!(%typ, "new connection type");
}
(best_addr, relay_url)
}
Expand Down

0 comments on commit d270d60

Please sign in to comment.