去除重复逻辑
This commit is contained in:
@@ -198,16 +198,16 @@ fn punch0(
|
|||||||
.collect();
|
.collect();
|
||||||
list.shuffle(&mut rand::thread_rng());
|
list.shuffle(&mut rand::thread_rng());
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
// 优先没打洞的
|
// // 优先没打洞的 need_punch会过滤掉已经打洞成功的
|
||||||
list.sort_by(|v1, v2| {
|
// list.sort_by(|v1, v2| {
|
||||||
if context.route_table.route_one_p2p(&v1.virtual_ip).is_none() {
|
// if context.route_table.route_one_p2p(&v1.virtual_ip).is_none() {
|
||||||
Ordering::Less
|
// Ordering::Less
|
||||||
} else if context.route_table.route_one_p2p(&v2.virtual_ip).is_none() {
|
// } else if context.route_table.route_one_p2p(&v2.virtual_ip).is_none() {
|
||||||
Ordering::Greater
|
// Ordering::Greater
|
||||||
} else {
|
// } else {
|
||||||
Ordering::Equal
|
// Ordering::Equal
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
for info in list {
|
for info in list {
|
||||||
if !info.status.is_online() {
|
if !info.status.is_online() {
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
Reference in New Issue
Block a user