From 607b595807df637214fa11aa7d8976b84f50e959 Mon Sep 17 00:00:00 2001 From: Christien Rioux Date: Sun, 10 Sep 2023 11:24:52 -0400 Subject: [PATCH] fixes --- .../native/discovery_context.rs | 2 +- .../native/network_class_discovery.rs | 26 +++++++++---------- veilid-core/src/veilid_api/debug.rs | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/veilid-core/src/network_manager/native/discovery_context.rs b/veilid-core/src/network_manager/native/discovery_context.rs index 5cc70cf4..830dc28d 100644 --- a/veilid-core/src/network_manager/native/discovery_context.rs +++ b/veilid-core/src/network_manager/native/discovery_context.rs @@ -420,7 +420,7 @@ impl DiscoveryContext { }; // If we have two different external addresses, then this is a symmetric NAT - if external_2.address != external_1.address { + if external_2.address.address() != external_1.address.address() { let do_symmetric_nat_fut: SendPinBoxFuture> = Box::pin(async move { Some(DetectedDialInfo::SymmetricNAT) }); unord.push(do_symmetric_nat_fut); diff --git a/veilid-core/src/network_manager/native/network_class_discovery.rs b/veilid-core/src/network_manager/native/network_class_discovery.rs index 62d0ba95..94db7ece 100644 --- a/veilid-core/src/network_manager/native/network_class_discovery.rs +++ b/veilid-core/src/network_manager/native/network_class_discovery.rs @@ -11,19 +11,6 @@ impl Network { .get_network_class(RoutingDomain::PublicInternet) .unwrap_or_default(); - // get existing dial info into table by protocol/address type - let mut existing_dial_info = BTreeMap::<(ProtocolType, AddressType), DialInfoDetail>::new(); - for did in self.routing_table().all_filtered_dial_info_details( - RoutingDomain::PublicInternet.into(), - &DialInfoFilter::all(), - ) { - // Only need to keep one per pt/at pair, since they will all have the same dialinfoclass - existing_dial_info.insert( - (did.dial_info.protocol_type(), did.dial_info.address_type()), - did, - ); - } - match ddi { DetectedDialInfo::SymmetricNAT => { // If we get any symmetric nat dialinfo, this whole network class is outbound only, @@ -39,6 +26,19 @@ impl Network { } } DetectedDialInfo::Detected(did) => { + // get existing dial info into table by protocol/address type + let mut existing_dial_info = + BTreeMap::<(ProtocolType, AddressType), DialInfoDetail>::new(); + for did in self.routing_table().all_filtered_dial_info_details( + RoutingDomain::PublicInternet.into(), + &DialInfoFilter::all(), + ) { + // Only need to keep one per pt/at pair, since they will all have the same dialinfoclass + existing_dial_info.insert( + (did.dial_info.protocol_type(), did.dial_info.address_type()), + did, + ); + } // We got a dial info, upgrade everything unless we are fixed to outbound only due to a symmetric nat if !matches!(existing_network_class, NetworkClass::OutboundOnly) { // Get existing dial info for protocol/address type combination diff --git a/veilid-core/src/veilid_api/debug.rs b/veilid-core/src/veilid_api/debug.rs index 17050629..38ee02f6 100644 --- a/veilid-core/src/veilid_api/debug.rs +++ b/veilid-core/src/veilid_api/debug.rs @@ -648,7 +648,7 @@ impl VeilidAPI { if !args.is_empty() { if args[0] == "buckets" { // Must be detached - if matches!( + if !matches!( self.get_state().await?.attachment.state, AttachmentState::Detached | AttachmentState::Detaching ) {