File tree 1 file changed +8
-8
lines changed
1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -1046,17 +1046,17 @@ async fn auto_mtu_detection(
1046
1046
size
1047
1047
} ) ;
1048
1048
1049
- let first_ping_size = match ping_stream
1049
+ let first_ping_size = ping_stream
1050
1050
. next ( )
1051
1051
. await
1052
1052
. expect ( "At least one pings should be sent" )
1053
- {
1054
- Ok ( size ) => size ,
1055
- // If the first ping we get back timed out, then all of them did
1056
- Err ( SurgeError :: Timeout { .. } ) => return Err ( Error :: MtuDetectionAllDropped ) ,
1057
- // Short circuit and return error on unexpected error types
1058
- Err ( e ) => return Err ( Error :: MtuDetectionPingError ( e) ) ,
1059
- } ;
1053
+ // Short-circuit and return on error
1054
+ . map_err ( |e| match e {
1055
+ // If the first ping we get back timed out, then all of them did
1056
+ SurgeError :: Timeout { .. } => Error :: MtuDetectionAllDropped ,
1057
+ // Unexpected error type
1058
+ e => Error :: MtuDetectionPingError ( e) ,
1059
+ } ) ? ;
1060
1060
1061
1061
ping_stream
1062
1062
. timeout ( PING_OFFSET_TIMEOUT ) // Start a new, sorter, timeout
You can’t perform that action at this time.
0 commit comments