diff --git a/crates/shadowsocks-service/src/local/redir/udprelay/mod.rs b/crates/shadowsocks-service/src/local/redir/udprelay/mod.rs index a28de664b3b3..f83db73cadf1 100644 --- a/crates/shadowsocks-service/src/local/redir/udprelay/mod.rs +++ b/crates/shadowsocks-service/src/local/redir/udprelay/mod.rs @@ -191,28 +191,28 @@ impl UdpInboundWrite for UdpRedirInboundWriter { } } - let send_result = inbound.send_to(data, peer_addr).await.map(|n| { - if n < data.len() { - warn!( - "udp redir send back data (actual: {} bytes, sent: {} bytes), remote: {}, peer: {}", + match inbound.send_to(data, peer_addr).await { + Ok(n) => { + if n < data.len() { + warn!( + "udp redir send back data (actual: {} bytes, sent: {} bytes), remote: {}, peer: {}", + n, + data.len(), + remote_addr, + peer_addr + ); + } + + trace!( + "udp redir send back data {} bytes, remote: {}, peer: {}, socket_opts: {:?}", n, - data.len(), remote_addr, - peer_addr + peer_addr, + self.socket_opts ); - } - trace!( - "udp redir send back data {} bytes, remote: {}, peer: {}, socket_opts: {:?}", - n, - remote_addr, - peer_addr, - self.socket_opts - ); - }); - - match send_result { - Ok(()) => return Ok(()), + return Ok(()); + } Err(err) => { match err.kind() { // Invalid Argument