From 64d68c8a844cdd7277eb05e28e6ad74f16848f65 Mon Sep 17 00:00:00 2001 From: lbl8603 <49143209+lbl8603@users.noreply.github.com> Date: Thu, 1 Aug 2024 23:23:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=89=93=E6=B4=9E=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vnt/src/handle/maintain/punch.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/vnt/src/handle/maintain/punch.rs b/vnt/src/handle/maintain/punch.rs index d4ef933..98ded7a 100644 --- a/vnt/src/handle/maintain/punch.rs +++ b/vnt/src/handle/maintain/punch.rs @@ -251,7 +251,7 @@ fn punch0( .collect(); list.shuffle(&mut rand::thread_rng()); for info in list { - if info.status.is_online() { + if info.status.is_offline() { // 客户端掉线了要重置打洞记录 punch_record.lock().remove(&info.virtual_ip); continue; @@ -266,12 +266,11 @@ fn punch0( let p2p_num = context.route_table.p2p_num(&info.virtual_ip); let mut max_punch_interval = 50; if p2p_num > 0 { - if punch_count == 0 { - continue; - } if p2p_num >= context.channel_num() { //通道数满足要求,不再打洞 - punch_record.lock().remove(&info.virtual_ip); + if punch_count != 0 { + punch_record.lock().remove(&info.virtual_ip); + } continue; } //有p2p通道,但是通道数量不够,则继续打洞