From 7b3415f3b41c94a434c62b141872a0cbcffd1747 Mon Sep 17 00:00:00 2001 From: zonyitoo Date: Wed, 28 Apr 2021 13:20:03 +0800 Subject: [PATCH] trigger CI to address dead lock --- crates/shadowsocks-service/src/server/udprelay.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/crates/shadowsocks-service/src/server/udprelay.rs b/crates/shadowsocks-service/src/server/udprelay.rs index 85b75536043f..ccb0e78eed26 100644 --- a/crates/shadowsocks-service/src/server/udprelay.rs +++ b/crates/shadowsocks-service/src/server/udprelay.rs @@ -414,11 +414,10 @@ impl UdpAssociationContext { let mut buffer = [0u8; MAXIMUM_UDP_PAYLOAD_SIZE]; loop { let (n, addr) = match outbound.recv_from(&mut buffer).await { - Ok((n, addr)) => { - trace!("udp relay {} <- {} received {} bytes", self.peer_addr, addr, n); + Ok(r) => { // Keep association alive in map let _ = self.assoc_map.lock().await.get(&self.peer_addr); - (n, addr) + r } Err(err) => { error!( @@ -430,6 +429,8 @@ impl UdpAssociationContext { } }; + trace!("udp relay {} <- {} received {} bytes", self.peer_addr, addr, n); + let data = &buffer[..n]; let target_addr = match self.target_cache.lock().await.get(&addr) { @@ -437,6 +438,14 @@ impl UdpAssociationContext { None => Address::from(addr), }; + trace!( + "udp relay {} <- {} ({}) with {} bytes", + self.peer_addr, + target_addr, + addr, + data.len() + ); + // Send back to client if let Err(err) = self.inbound.send_to(self.peer_addr, &target_addr, data).await { warn!(