Skip to content

Commit 8851920

Browse files
committed
Clarify MTU spacing function
1 parent 0b820ab commit 8851920

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

talpid-wireguard/src/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1075,7 +1075,8 @@ fn mtu_spacing(mtu_min: u16, mtu_max: u16, step_size: u16) -> Vec<u16> {
10751075
if mtu_min > mtu_max {
10761076
panic!("Invalid MTU detection range: `mtu_min`={mtu_min}, `mtu_max`={mtu_max}.");
10771077
}
1078-
let in_between = ((mtu_min + 1)..mtu_max).filter(|x| x % step_size == 0);
1078+
let second_mtu = mtu_min.next_multiple_of(step_size);
1079+
let in_between = (second_mtu..mtu_max).step_by(step_size as usize);
10791080
let mut ret = Vec::with_capacity(((mtu_max - mtu_min) / 3 + 2) as usize);
10801081
ret.push(mtu_min);
10811082
ret.extend(in_between);

0 commit comments

Comments
 (0)