Skip to content

Commit

Permalink
Merge branch 'refs/heads/bugfix/2024-08-01-修复打洞问题' into 1.2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
vnt-dev committed Aug 1, 2024
2 parents 210b7c9 + 64d68c8 commit 4347ed6
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions vnt/src/handle/maintain/punch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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通道,但是通道数量不够,则继续打洞
Expand Down

0 comments on commit 4347ed6

Please sign in to comment.