Skip to content

Commit 12d23c3

Browse files
committed
Comments
1 parent ef586d1 commit 12d23c3

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

talpid-wireguard/src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1036,6 +1036,7 @@ async fn auto_mtu_detection(
10361036

10371037
let res = set
10381038
.map(|res| match res {
1039+
// Map successful pings to packet size
10391040
Ok((packet, _rtt)) => {
10401041
let surge_ping::IcmpPacket::V4(packet) = packet else {
10411042
panic!("ICMP ping response was not of IPv4 type");
@@ -1045,10 +1046,12 @@ async fn auto_mtu_detection(
10451046
debug_assert_eq!(size, linspace[packet.get_sequence().0 as usize]);
10461047
Ok(Some(size))
10471048
}
1049+
// Filter out dropped pings
10481050
Err(SurgeError::Timeout { seq }) => {
10491051
log::info!("Ping of size {} dropped", linspace[seq.0 as usize]);
10501052
Ok(None)
10511053
}
1054+
// Short circuit and return error on unexpected error types
10521055
Err(e) => Err(e),
10531056
})
10541057
.try_fold(None, |acc, x| async move { Ok(std::cmp::max(acc, x)) })

0 commit comments

Comments
 (0)