@@ -128,15 +128,13 @@ impl UdpSocketState {
128128 // Enable IP_RECVERR and IPV6_RECVERR for ICMP Errors
129129 #[ cfg( target_os = "linux" ) ]
130130 if is_ipv4 {
131- if let Err ( e) = set_socket_option ( & * io, libc:: IPPROTO_IP , libc:: IP_RECVERR , OPTION_ON ) {
132- crate :: log:: warn!( "Failed to enable IP_RECVERR: {}" , e) ;
133- }
134- } else {
135- if let Err ( e) =
136- set_socket_option ( & * io, libc:: IPPROTO_IPV6 , libc:: IPV6_RECVERR , OPTION_ON )
137- {
138- crate :: log:: warn!( "Failed to enable IPV6_RECVERR: {}" , e) ;
131+ if let Err ( _err) = set_socket_option ( & * io, libc:: IPPROTO_IP , libc:: IP_RECVERR , OPTION_ON ) {
132+ crate :: log:: warn!( "Failed to enable IP_RECVERR: {}" , _err) ;
139133 }
134+ } else if let Err ( _err) =
135+ set_socket_option ( & * io, libc:: IPPROTO_IPV6 , libc:: IPV6_RECVERR , OPTION_ON )
136+ {
137+ crate :: log:: warn!( "Failed to enable IPV6_RECVERR: {}" , _err) ;
140138 }
141139
142140 let mut may_fragment = false ;
@@ -523,22 +521,22 @@ fn recv(io: SockRef<'_>, bufs: &mut [IoSliceMut<'_>], meta: &mut [RecvMeta]) ->
523521 {
524522 use std:: os:: fd:: AsFd ;
525523 // Clear the error queue after processing normal packets
526- while let Ok ( Some ( ( addr , err) ) ) = recv_err ( & io. as_fd ( ) ) {
524+ while let Ok ( Some ( ( _addr , err) ) ) = recv_err ( & io. as_fd ( ) ) {
527525 crate :: log:: debug!(
528526 "ICMP error from {}: origin: {}, type: {}, code: {}, err_no: {} " ,
529- addr ,
527+ _addr ,
530528 err. ee_origin,
531529 err. ee_type,
532530 err. ee_code,
533531 err. ee_errno
534532 ) ;
535533 match ( err. ee_origin , err. ee_type , err. ee_code ) {
536534 ( libc:: SO_EE_ORIGIN_ICMP , 3 , 0 ) => {
537- crate :: log:: warn!( "Network Unreachable: {}" , addr )
535+ crate :: log:: warn!( "Network Unreachable: {}" , _addr )
538536 }
539- ( libc:: SO_EE_ORIGIN_ICMP , 3 , 1 ) => crate :: log:: warn!( "Host Unreachable: {}" , addr ) ,
540- ( libc:: SO_EE_ORIGIN_ICMP , 3 , 2 ) => crate :: log:: warn!( "PORT Unreachable: {}" , addr ) ,
541- ( libc:: SO_EE_ORIGIN_ICMP6 , 1 , 0 ) => crate :: log:: warn!( "IPv6 Unreachable: {}" , addr ) ,
537+ ( libc:: SO_EE_ORIGIN_ICMP , 3 , 1 ) => crate :: log:: warn!( "Host Unreachable: {}" , _addr ) ,
538+ ( libc:: SO_EE_ORIGIN_ICMP , 3 , 2 ) => crate :: log:: warn!( "PORT Unreachable: {}" , _addr ) ,
539+ ( libc:: SO_EE_ORIGIN_ICMP6 , 1 , 0 ) => crate :: log:: warn!( "IPv6 Unreachable: {}" , _addr ) ,
542540 _ => crate :: log:: warn!( "Other ICMP error: {:?}" , err) ,
543541 } ;
544542 }
@@ -924,10 +922,10 @@ fn recv_err(io: &impl AsRawFd) -> io::Result<Option<(SocketAddr, SockExtendedErr
924922}
925923
926924// I don't know about how other platforms handle this.
927- #[ cfg( not( target_os = "linux" ) ) ]
928- fn recv_error_queue ( _io : & impl AsRawFd ) -> io:: Result < Option < ( SocketAddr , ( ) ) > > {
929- Ok ( None )
930- }
925+ // #[cfg(not(target_os = "linux"))]
926+ // fn recv_err (_io: &impl AsRawFd) -> io::Result<Option<(SocketAddr, ())>> {
927+ // Ok(None)
928+ // }
931929
932930#[ cfg( not( apple_slow) ) ]
933931// Chosen somewhat arbitrarily; might benefit from additional tuning.
0 commit comments