1
0

releasing lock before await-point

This commit is contained in:
EAimTY 2023-05-29 18:47:24 +09:00
parent 882fbcf669
commit 191dffd03e
2 changed files with 5 additions and 4 deletions

View File

@ -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}",

View File

@ -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}"),