mirror of
https://github.com/dndx/phantun.git
synced 2025-09-06 23:37:28 +08:00
style(phantun): use Rust 2024 &&
combination for if let
This commit is contained in:
parent
86133609da
commit
77b2c41518
@ -245,13 +245,12 @@ async fn main() -> io::Result<()> {
|
||||
res = sock.recv(&mut buf_tcp) => {
|
||||
match res {
|
||||
Some(size) => {
|
||||
if size > 0 {
|
||||
if let Err(e) = udp_sock.send(&buf_tcp[..size]).await {
|
||||
if size > 0
|
||||
&& let Err(e) = udp_sock.send(&buf_tcp[..size]).await {
|
||||
error!("Unable to send UDP packet to {}: {}, closing connection", e, addr);
|
||||
quit.cancel();
|
||||
return;
|
||||
}
|
||||
}
|
||||
},
|
||||
None => {
|
||||
debug!("removed fake TCP socket from connections table");
|
||||
|
@ -219,13 +219,12 @@ async fn main() -> io::Result<()> {
|
||||
res = sock.recv(&mut buf_tcp) => {
|
||||
match res {
|
||||
Some(size) => {
|
||||
if size > 0 {
|
||||
if let Err(e) = udp_sock.send(&buf_tcp[..size]).await {
|
||||
if size > 0
|
||||
&& let Err(e) = udp_sock.send(&buf_tcp[..size]).await {
|
||||
error!("Unable to send UDP packet to {}: {}, closing connection", e, remote_addr);
|
||||
quit.cancel();
|
||||
return;
|
||||
}
|
||||
}
|
||||
},
|
||||
None => {
|
||||
quit.cancel();
|
||||
|
Loading…
x
Reference in New Issue
Block a user