diff --git a/tuic-client/src/connection.rs b/tuic-client/src/connection.rs index 118cba5..5bdd4f2 100644 --- a/tuic-client/src/connection.rs +++ b/tuic-client/src/connection.rs @@ -508,13 +508,14 @@ impl Connection { Address::SocketAddress(addr) => Socks5Address::SocketAddress(addr), }; - if let Some(session) = SOCKS5_UDP_SESSIONS + let session = SOCKS5_UDP_SESSIONS .get() .unwrap() .lock() .get(&assoc_id) - .cloned() - { + .cloned(); + + if let Some(session) = session { if let Err(err) = session.send(pkt, addr).await { log::warn!( "[relay] [packet] [{assoc_id:#06x}] [from-native] [{pkt_id:#06x}] failed sending packet to socks5 client: {err}", diff --git a/tuic-client/src/socks5.rs b/tuic-client/src/socks5.rs index 142dd2d..b71afa2 100644 --- a/tuic-client/src/socks5.rs +++ b/tuic-client/src/socks5.rs @@ -147,7 +147,7 @@ impl Server { Self::handle_bind(bind).await; } Ok(Connection::Connect(connect, target_addr)) => { - log::info!("[socks5] [{addr}] [connect] [{target_addr}]"); + log::info!("[socks5] [{addr}] [connect] {target_addr}"); Self::handle_connect(connect, target_addr).await; } Err(err) => log::warn!("[socks5] [{addr}] handshake error: {err}"),