Skip to content

Commit

Permalink
chore(local-redir): Better code style
Browse files Browse the repository at this point in the history
  • Loading branch information
zonyitoo committed Jun 16, 2024
1 parent eddd439 commit c1da627
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions crates/shadowsocks-service/src/local/redir/udprelay/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c1da627

Please sign in to comment.