diff --git a/iroh-net/src/magicsock/node_map/node_state.rs b/iroh-net/src/magicsock/node_map/node_state.rs index 7a69b57117..375fb706d7 100644 --- a/iroh-net/src/magicsock/node_map/node_state.rs +++ b/iroh-net/src/magicsock/node_map/node_state.rs @@ -303,46 +303,31 @@ impl NodeState { // Update some metrics match (prev_typ, typ) { - (ConnectionType::Direct(_), ConnectionType::Direct(_)) => (), - (ConnectionType::Direct(_), ConnectionType::Relay(_)) => { - inc!(MagicsockMetrics, num_direct_conns_removed); - inc!(MagicsockMetrics, num_relay_conns_added); - } - (ConnectionType::Direct(_), ConnectionType::Mixed(_, _)) => { - inc!(MagicsockMetrics, num_direct_conns_removed); - inc!(MagicsockMetrics, num_relay_conns_added); - } - (ConnectionType::Direct(_), ConnectionType::None) => { - inc!(MagicsockMetrics, num_direct_conns_removed) - } - (ConnectionType::Relay(_), ConnectionType::Direct(_)) => { - inc!(MagicsockMetrics, num_direct_conns_added); - inc!(MagicsockMetrics, num_relay_conns_removed); - } - (ConnectionType::Relay(_), ConnectionType::Relay(_)) => (), - (ConnectionType::Relay(_), ConnectionType::Mixed(_, _)) => (), - (ConnectionType::Relay(_), ConnectionType::None) => { - inc!(MagicsockMetrics, num_relay_conns_removed) - } - (ConnectionType::Mixed(_, _), ConnectionType::Direct(_)) => { + (ConnectionType::Relay(_), ConnectionType::Direct(_)) + | (ConnectionType::Mixed(_, _), ConnectionType::Direct(_)) => { inc!(MagicsockMetrics, num_direct_conns_added); inc!(MagicsockMetrics, num_relay_conns_removed); } - (ConnectionType::Mixed(_, _), ConnectionType::Relay(_)) => (), - (ConnectionType::Mixed(_, _), ConnectionType::Mixed(_, _)) => (), - (ConnectionType::Mixed(_, _), ConnectionType::None) => { - inc!(MagicsockMetrics, num_relay_conns_removed) + (ConnectionType::Direct(_), ConnectionType::Relay(_)) + | (ConnectionType::Direct(_), ConnectionType::Mixed(_, _)) => { + inc!(MagicsockMetrics, num_direct_conns_removed); + inc!(MagicsockMetrics, num_relay_conns_added); } (ConnectionType::None, ConnectionType::Direct(_)) => { inc!(MagicsockMetrics, num_direct_conns_added) } - (ConnectionType::None, ConnectionType::Relay(_)) => { - inc!(MagicsockMetrics, num_relay_conns_added) + (ConnectionType::Direct(_), ConnectionType::None) => { + inc!(MagicsockMetrics, num_direct_conns_removed) } - (ConnectionType::None, ConnectionType::Mixed(_, _)) => { + (ConnectionType::None, ConnectionType::Relay(_)) + | (ConnectionType::None, ConnectionType::Mixed(_, _)) => { inc!(MagicsockMetrics, num_relay_conns_added) } - (ConnectionType::None, ConnectionType::None) => (), + (ConnectionType::Relay(_), ConnectionType::None) + | (ConnectionType::Mixed(_, _), ConnectionType::None) => { + inc!(MagicsockMetrics, num_relay_conns_removed) + } + _ => (), } } (best_addr, relay_url)