From 7f210e9319c3bb9fdd97715517f40475f89afee4 Mon Sep 17 00:00:00 2001 From: lbl8603 <49143209+lbl8603@users.noreply.github.com> Date: Mon, 17 Jun 2024 23:44:11 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=8E=B7=E5=8F=96=E5=9C=B0?= =?UTF-8?q?=E5=9D=80=E9=A2=91=E7=8E=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vnt/src/handle/maintain/addr_request.rs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/vnt/src/handle/maintain/addr_request.rs b/vnt/src/handle/maintain/addr_request.rs index dc66f64..638ba36 100644 --- a/vnt/src/handle/maintain/addr_request.rs +++ b/vnt/src/handle/maintain/addr_request.rs @@ -40,7 +40,6 @@ fn pub_address_request( ) { let channel_num = context.channel_num(); let index = count % channel_num; - let mut time = if index == channel_num - 1 { 19 } else { 1 }; if let Err(e) = addr_request0( &context, ¤t_device_info, @@ -51,12 +50,20 @@ fn pub_address_request( log::warn!("{:?}", e); } let nat_info = nat_test.nat_info(); - if nat_info.nat_type == NatType::Symmetric { + let time = if !nat_info.public_ports.contains(&0) && !nat_info.public_ips.is_empty() { //对称网络探测端口没啥作用,把频率放低,(锥形网络也只在打洞前需要探测端口,后续可以改改) - if !nat_info.public_ports.contains(&0) && !nat_info.public_ips.is_empty() { - time = 600; + if nat_info.nat_type == NatType::Symmetric { + 600 + } else { + if index == channel_num - 1 { + 19 + } else { + 7 + } } - } + } else { + 3 + }; let rs = scheduler.timeout(Duration::from_secs(time), move |s| { pub_address_request(