From dfcdcf2364d9d2635dcc6d1ebc86fac9eca17e4b Mon Sep 17 00:00:00 2001 From: Christien Rioux Date: Tue, 5 Sep 2023 09:44:49 -0400 Subject: [PATCH] xfer --- .../native/discovery_context.rs | 57 +++++++++++-------- 1 file changed, 32 insertions(+), 25 deletions(-) diff --git a/veilid-core/src/network_manager/native/discovery_context.rs b/veilid-core/src/network_manager/native/discovery_context.rs index 2f3344b2..7a4b1a01 100644 --- a/veilid-core/src/network_manager/native/discovery_context.rs +++ b/veilid-core/src/network_manager/native/discovery_context.rs @@ -375,7 +375,10 @@ impl DiscoveryContext { // If we know we are not behind NAT, check our firewall status #[instrument(level = "trace", skip(self), ret)] - async fn protocol_process_no_nat(&self) -> DetectedDialInfo { + async fn protocol_process_no_nat( + &self, + unord: &mut FuturesUnordered>>, + ) -> DetectedDialInfo { let external_1 = self.inner.lock().external_1.as_ref().unwrap().clone(); // Do a validate_dial_info on the external address from a redirected node @@ -399,7 +402,10 @@ impl DiscoveryContext { // If we know we are behind NAT check what kind #[instrument(level = "trace", skip(self), ret)] - async fn protocol_process_nat(&self) -> Option { + async fn protocol_process_nat( + &self, + unord: &mut FuturesUnordered>>, + ) -> Option { // Get the external dial info for our use here let external_1 = self.inner.lock().external_1.as_ref().unwrap().clone(); let external_2 = self.inner.lock().external_2.as_ref().unwrap().clone(); @@ -553,30 +559,31 @@ impl DiscoveryContext { let external_1 = self.inner.lock().external_1.as_ref().unwrap().clone(); if self.unlocked_inner.intf_addrs.contains(&external_1.address) { - this.protocol_process_no_nat(unord).await - xxx continue here + self.protocol_process_no_nat(unord).await; } else { - // Loop for restricted NAT retries - let this = self.clone(); - let do_nat_fut: SendPinBoxFuture> = Box::pin(async move { - loop { - // There is -some NAT- - if let Some(ddi) = this.protocol_process_nat().await { - if let DetectedDialInfo::Detected(did) = &ddi { - // If we got something better than restricted NAT or we're done retrying - if did.class < DialInfoClass::AddressRestrictedNAT || retry_count == 0 { - return Some(ddi); - } - } - } - if retry_count == 0 { - break; - } - retry_count -= 1; - } - None - }); - unord.push(do_nat_fut); + self.protocol_process_nat(unord).await; + + // // Loop for restricted NAT retries + // let this = self.clone(); + // let do_nat_fut: SendPinBoxFuture> = Box::pin(async move { + // loop { + // // There is -some NAT- + // if let Some(ddi) = this.protocol_process_nat().await { + // if let DetectedDialInfo::Detected(did) = &ddi { + // // If we got something better than restricted NAT or we're done retrying + // if did.class < DialInfoClass::AddressRestrictedNAT || retry_count == 0 { + // return Some(ddi); + // } + // } + // } + // if retry_count == 0 { + // break; + // } + // retry_count -= 1; + // } + // None + // }); + // unord.push(do_nat_fut); } } }