Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
erebe committed Jan 7, 2024
1 parent bdf88d0 commit f97bdc7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@ async fn main() {
.map_ok(move |stream| {
// In TProxy mode local destination is the final ip:port destination
let (host, port) = to_host_port(stream.local_addr().unwrap());
(tokio::io::split(stream), (LocalProtocol::Udp { timeout: timeout }, host, port))
(tokio::io::split(stream), (LocalProtocol::Udp { timeout }, host, port))
});

tokio::spawn(async move {
Expand All @@ -789,7 +789,7 @@ async fn main() {
LocalProtocol::Udp { timeout } => {
let (host, port) = tunnel.remote.clone();
let timeout = *timeout;
let server = udp::run_server(tunnel.local, timeout.clone(), |_| Ok(()), |s| Ok(s.clone()))
let server = udp::run_server(tunnel.local, timeout, |_| Ok(()), |s| Ok(s.clone()))
.await
.unwrap_or_else(|err| panic!("Cannot start UDP server on {}: {}", tunnel.local, err))
.map_err(anyhow::Error::new)
Expand Down
2 changes: 1 addition & 1 deletion src/socks5_udp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ pub async fn run_server(

match server.peers.get(&destination_addr) {
Some(io) => {
if let Err(_) = io.sender.send(data).await {
if io.sender.send(data).await.is_err() {
server.peers.remove(&destination_addr);
}
}
Expand Down

0 comments on commit f97bdc7

Please sign in to comment.