From bbf8fb30a35edfa5c4eecb64bc430119ed8fb1cb Mon Sep 17 00:00:00 2001 From: zonyitoo Date: Thu, 15 Apr 2021 18:44:59 +0800 Subject: [PATCH] make clippy happier --- crates/shadowsocks-service/src/acl/mod.rs | 2 +- crates/shadowsocks-service/src/config.rs | 25 ++-- .../shadowsocks-service/src/local/context.rs | 6 + .../src/local/dns/dns_resolver.rs | 140 +++++++++--------- .../src/local/dns/server.rs | 2 +- .../src/local/dns/upstream.rs | 1 + .../src/local/http/http_stream.rs | 1 + .../src/local/http/server.rs | 6 + .../src/local/loadbalancing/server_data.rs | 12 +- .../src/local/loadbalancing/server_stat.rs | 12 +- crates/shadowsocks-service/src/local/mod.rs | 2 +- .../src/local/redir/server.rs | 6 + .../src/local/redir/sys/unix/bsd_pf.rs | 6 + .../src/local/redir/udprelay/mod.rs | 1 + .../local/socks/client/socks5/udp_client.rs | 2 +- .../src/local/socks/server/mod.rs | 10 +- .../shadowsocks-service/src/manager/server.rs | 2 +- crates/shadowsocks-service/src/net/flow.rs | 12 +- .../shadowsocks-service/src/server/context.rs | 12 +- crates/shadowsocks-service/src/server/mod.rs | 9 +- .../src/server/udprelay.rs | 4 +- 21 files changed, 161 insertions(+), 112 deletions(-) diff --git a/crates/shadowsocks-service/src/acl/mod.rs b/crates/shadowsocks-service/src/acl/mod.rs index 6ccbe63f6456..fd990de8084a 100644 --- a/crates/shadowsocks-service/src/acl/mod.rs +++ b/crates/shadowsocks-service/src/acl/mod.rs @@ -93,7 +93,7 @@ impl Rules { /// Check if there are no rules for domain names fn is_host_empty(&self) -> bool { - self.rule.len() == 0 + self.rule.is_empty() } } diff --git a/crates/shadowsocks-service/src/config.rs b/crates/shadowsocks-service/src/config.rs index 6671828309af..7f904656559c 100644 --- a/crates/shadowsocks-service/src/config.rs +++ b/crates/shadowsocks-service/src/config.rs @@ -1332,11 +1332,10 @@ impl Config { #[cfg(any(feature = "trust-dns", feature = "local-dns"))] fn parse_dns_nameservers(nameservers: &str) -> Result { #[cfg(all(unix, feature = "local-dns"))] - if nameservers.starts_with("unix://") { + if let Some(nameservers) = nameservers.strip_prefix("unix://") { // A special DNS server only for shadowsocks-android // It serves like a TCP DNS server but using unix domain sockets - let nameservers = &nameservers[7..]; return Ok(DnsConfig::LocalDns(NameServerAddr::UnixSocketAddr(PathBuf::from( nameservers, )))); @@ -1581,20 +1580,14 @@ impl fmt::Display for Config { ServerAddr::SocketAddr(ref sa) => sa.port(), ServerAddr::DomainName(.., port) => port, }, - local_udp_address: match local.udp_addr { - None => None, - Some(ref udp_addr) => Some(match udp_addr { - ServerAddr::SocketAddr(ref sa) => sa.ip().to_string(), - ServerAddr::DomainName(ref dm, ..) => dm.to_string(), - }), - }, - local_udp_port: match local.udp_addr { - None => None, - Some(ref udp_addr) => Some(match udp_addr { - ServerAddr::SocketAddr(ref sa) => sa.port(), - ServerAddr::DomainName(.., port) => *port, - }), - }, + local_udp_address: local.udp_addr.as_ref().map(|udp_addr| match udp_addr { + ServerAddr::SocketAddr(sa) => sa.ip().to_string(), + ServerAddr::DomainName(dm, ..) => dm.to_string(), + }), + local_udp_port: local.udp_addr.as_ref().map(|udp_addr| match udp_addr { + ServerAddr::SocketAddr(sa) => sa.port(), + ServerAddr::DomainName(.., port) => *port, + }), mode: Some(local.mode.to_string()), protocol: match local.protocol { ProtocolType::Socks => None, diff --git a/crates/shadowsocks-service/src/local/context.rs b/crates/shadowsocks-service/src/local/context.rs index 0300976e896a..fde296c804bd 100644 --- a/crates/shadowsocks-service/src/local/context.rs +++ b/crates/shadowsocks-service/src/local/context.rs @@ -35,6 +35,12 @@ pub struct ServiceContext { reverse_lookup_cache: Mutex>, } +impl Default for ServiceContext { + fn default() -> Self { + ServiceContext::new() + } +} + impl ServiceContext { /// Create a new `ServiceContext` pub fn new() -> ServiceContext { diff --git a/crates/shadowsocks-service/src/local/dns/dns_resolver.rs b/crates/shadowsocks-service/src/local/dns/dns_resolver.rs index d161d34f5944..50cbe469a6df 100644 --- a/crates/shadowsocks-service/src/local/dns/dns_resolver.rs +++ b/crates/shadowsocks-service/src/local/dns/dns_resolver.rs @@ -126,93 +126,95 @@ impl DnsResolve for DnsResolver { msgv6.set_recursion_desired(true); msgv6.add_query(queryv6); - let (res_v4, res_v6) = future::join(self.lookup(msgv4), self.lookup(msgv6)).await; - - if res_v4.is_err() && res_v6.is_err() { - return if self.ipv6_first { - Err(res_v6.unwrap_err()) - } else { - Err(res_v4.unwrap_err()) - }; - } + match future::join(self.lookup(msgv4), self.lookup(msgv6)).await { + (Err(res_v4), Err(res_v6)) => { + if self.ipv6_first { + Err(res_v6) + } else { + Err(res_v4) + } + } - let mut vaddr = Vec::new(); - - if self.ipv6_first { - match res_v6 { - Ok(res) => { - for record in res.answers() { - match *record.rdata() { - RData::A(addr) => vaddr.push(SocketAddr::new(addr.into(), port)), - RData::AAAA(addr) => vaddr.push(SocketAddr::new(addr.into(), port)), - ref rdata => { - trace!("skipped rdata {:?}", rdata); + (res_v4, res_v6) => { + let mut vaddr = Vec::new(); + + if self.ipv6_first { + match res_v6 { + Ok(res) => { + for record in res.answers() { + match *record.rdata() { + RData::A(addr) => vaddr.push(SocketAddr::new(addr.into(), port)), + RData::AAAA(addr) => vaddr.push(SocketAddr::new(addr.into(), port)), + ref rdata => { + trace!("skipped rdata {:?}", rdata); + } + } } } + Err(err) => { + debug!("failed to resolve AAAA records, error: {}", err); + } } - } - Err(err) => { - debug!("failed to resolve AAAA records, error: {}", err); - } - } - match res_v4 { - Ok(res) => { - for record in res.answers() { - match *record.rdata() { - RData::A(addr) => vaddr.push(SocketAddr::new(addr.into(), port)), - RData::AAAA(addr) => vaddr.push(SocketAddr::new(addr.into(), port)), - ref rdata => { - trace!("skipped rdata {:?}", rdata); + match res_v4 { + Ok(res) => { + for record in res.answers() { + match *record.rdata() { + RData::A(addr) => vaddr.push(SocketAddr::new(addr.into(), port)), + RData::AAAA(addr) => vaddr.push(SocketAddr::new(addr.into(), port)), + ref rdata => { + trace!("skipped rdata {:?}", rdata); + } + } } } + Err(err) => { + debug!("failed to resolve A records, error: {}", err); + } } - } - Err(err) => { - debug!("failed to resolve A records, error: {}", err); - } - } - } else { - match res_v4 { - Ok(res) => { - for record in res.answers() { - match *record.rdata() { - RData::A(addr) => vaddr.push(SocketAddr::new(addr.into(), port)), - RData::AAAA(addr) => vaddr.push(SocketAddr::new(addr.into(), port)), - ref rdata => { - trace!("skipped rdata {:?}", rdata); + } else { + match res_v4 { + Ok(res) => { + for record in res.answers() { + match *record.rdata() { + RData::A(addr) => vaddr.push(SocketAddr::new(addr.into(), port)), + RData::AAAA(addr) => vaddr.push(SocketAddr::new(addr.into(), port)), + ref rdata => { + trace!("skipped rdata {:?}", rdata); + } + } } } + Err(err) => { + debug!("failed to resolve A records, error: {}", err); + } } - } - Err(err) => { - debug!("failed to resolve A records, error: {}", err); - } - } - match res_v6 { - Ok(res) => { - for record in res.answers() { - match *record.rdata() { - RData::A(addr) => vaddr.push(SocketAddr::new(addr.into(), port)), - RData::AAAA(addr) => vaddr.push(SocketAddr::new(addr.into(), port)), - ref rdata => { - trace!("skipped rdata {:?}", rdata); + match res_v6 { + Ok(res) => { + for record in res.answers() { + match *record.rdata() { + RData::A(addr) => vaddr.push(SocketAddr::new(addr.into(), port)), + RData::AAAA(addr) => vaddr.push(SocketAddr::new(addr.into(), port)), + ref rdata => { + trace!("skipped rdata {:?}", rdata); + } + } } } + Err(err) => { + debug!("failed to resolve AAAA records, error: {}", err); + } } } - Err(err) => { - debug!("failed to resolve AAAA records, error: {}", err); + + if vaddr.is_empty() { + let err = io::Error::new(ErrorKind::InvalidData, "resolve empty"); + return Err(err); } - } - } - if vaddr.is_empty() { - let err = io::Error::new(ErrorKind::InvalidData, "resolve empty"); - return Err(err); + Ok(vaddr) + } } - - Ok(vaddr) } } diff --git a/crates/shadowsocks-service/src/local/dns/server.rs b/crates/shadowsocks-service/src/local/dns/server.rs index efadf7f75394..b6d3b63172c7 100644 --- a/crates/shadowsocks-service/src/local/dns/server.rs +++ b/crates/shadowsocks-service/src/local/dns/server.rs @@ -254,7 +254,7 @@ impl Dns { Ok(m) => m, Err(err) => { error!("dns udp {} lookup failed, error: {}", peer_addr, err); - return Err(err.into()); + return Err(err); } }; diff --git a/crates/shadowsocks-service/src/local/dns/upstream.rs b/crates/shadowsocks-service/src/local/dns/upstream.rs index 9b745ec876bf..c6595f620c07 100644 --- a/crates/shadowsocks-service/src/local/dns/upstream.rs +++ b/crates/shadowsocks-service/src/local/dns/upstream.rs @@ -29,6 +29,7 @@ use trust_dns_resolver::proto::{ use crate::net::{FlowStat, MonProxySocket, MonProxyStream}; /// Collection of various DNS connections +#[allow(clippy::large_enum_variant)] pub enum DnsClient { TcpLocal { stream: TcpStream, diff --git a/crates/shadowsocks-service/src/local/http/http_stream.rs b/crates/shadowsocks-service/src/local/http/http_stream.rs index af12cbb59d56..c0b0dc0de373 100644 --- a/crates/shadowsocks-service/src/local/http/http_stream.rs +++ b/crates/shadowsocks-service/src/local/http/http_stream.rs @@ -12,6 +12,7 @@ use tokio::io::{AsyncRead, AsyncWrite, ReadBuf}; use crate::local::net::AutoProxyClientStream; +#[allow(clippy::large_enum_variant)] #[pin_project(project = ProxyHttpStreamProj)] pub enum ProxyHttpStream { Http(#[pin] AutoProxyClientStream), diff --git a/crates/shadowsocks-service/src/local/http/server.rs b/crates/shadowsocks-service/src/local/http/server.rs index 4302f56b2a2e..c0e96b3a2f29 100644 --- a/crates/shadowsocks-service/src/local/http/server.rs +++ b/crates/shadowsocks-service/src/local/http/server.rs @@ -27,6 +27,12 @@ pub struct Http { proxy_client_cache: Arc, } +impl Default for Http { + fn default() -> Self { + Http::new() + } +} + impl Http { /// Create a new HTTP Local server pub fn new() -> Http { diff --git a/crates/shadowsocks-service/src/local/loadbalancing/server_data.rs b/crates/shadowsocks-service/src/local/loadbalancing/server_data.rs index 2752ac40ec99..b28d54fac508 100644 --- a/crates/shadowsocks-service/src/local/loadbalancing/server_data.rs +++ b/crates/shadowsocks-service/src/local/loadbalancing/server_data.rs @@ -16,14 +16,20 @@ pub struct ServerScore { score: AtomicU32, } -impl ServerScore { - /// Create a `ServerScore` - pub fn new() -> ServerScore { +impl Default for ServerScore { + fn default() -> Self { ServerScore { stat_data: Mutex::new(ServerStat::new()), score: AtomicU32::new(0), } } +} + +impl ServerScore { + /// Create a `ServerScore` + pub fn new() -> ServerScore { + ServerScore::default() + } /// Get server's current statistic scores pub fn score(&self) -> u32 { diff --git a/crates/shadowsocks-service/src/local/loadbalancing/server_stat.rs b/crates/shadowsocks-service/src/local/loadbalancing/server_stat.rs index be62e5013ec7..fec6ced1d940 100644 --- a/crates/shadowsocks-service/src/local/loadbalancing/server_stat.rs +++ b/crates/shadowsocks-service/src/local/loadbalancing/server_stat.rs @@ -46,8 +46,8 @@ fn max_latency_stdev() -> f64 { (diff1 + diff2).sqrt() } -impl ServerStat { - pub fn new() -> ServerStat { +impl Default for ServerStat { + fn default() -> Self { ServerStat { rtt: MAX_SERVER_RTT, fail_rate: 1.0, @@ -56,6 +56,12 @@ impl ServerStat { latency_mean: 0.0, } } +} + +impl ServerStat { + pub fn new() -> ServerStat { + ServerStat::default() + } fn score(&self) -> u32 { // Normalize rtt @@ -109,7 +115,7 @@ impl ServerStat { self.fail_rate = cerr as f64 / self.latency_queue.len() as f64; if !vlat.is_empty() { - vlat.sort(); + vlat.sort_unstable(); // Find median of latency let mid = vlat.len() / 2; diff --git a/crates/shadowsocks-service/src/local/mod.rs b/crates/shadowsocks-service/src/local/mod.rs index b40f2e27a939..b204b7c88d4d 100644 --- a/crates/shadowsocks-service/src/local/mod.rs +++ b/crates/shadowsocks-service/src/local/mod.rs @@ -45,7 +45,7 @@ pub mod utils; /// Starts a shadowsocks local server pub async fn run(mut config: Config) -> io::Result<()> { assert!(config.config_type == ConfigType::Local && !config.local.is_empty()); - assert!(config.server.len() > 0); + assert!(!config.server.is_empty()); trace!("{:?}", config); diff --git a/crates/shadowsocks-service/src/local/redir/server.rs b/crates/shadowsocks-service/src/local/redir/server.rs index 863b02aaff8f..28420429342b 100644 --- a/crates/shadowsocks-service/src/local/redir/server.rs +++ b/crates/shadowsocks-service/src/local/redir/server.rs @@ -23,6 +23,12 @@ pub struct Redir { udp_redir: RedirType, } +impl Default for Redir { + fn default() -> Self { + Redir::new() + } +} + impl Redir { /// Create a new transparent proxy server with default configuration pub fn new() -> Redir { diff --git a/crates/shadowsocks-service/src/local/redir/sys/unix/bsd_pf.rs b/crates/shadowsocks-service/src/local/redir/sys/unix/bsd_pf.rs index 71d6953b1c58..b86aa4745e3f 100644 --- a/crates/shadowsocks-service/src/local/redir/sys/unix/bsd_pf.rs +++ b/crates/shadowsocks-service/src/local/redir/sys/unix/bsd_pf.rs @@ -165,6 +165,7 @@ impl PacketFilter { let addr: *const libc::in_addr = &((*sockaddr).sin_addr) as *const _; let port: libc::in_port_t = (*sockaddr).sin_port; + #[allow(clippy::size_of_in_element_count)] ptr::copy_nonoverlapping(addr, &mut pnl.daddr.pfa.v4, mem::size_of_val(&pnl.daddr.pfa.v4)); pnl.set_dport(port); } @@ -177,6 +178,7 @@ impl PacketFilter { let addr: *const libc::in6_addr = &((*sockaddr).sin6_addr) as *const _; let port: libc::in_port_t = (*sockaddr).sin6_port; + #[allow(clippy::size_of_in_element_count)] ptr::copy_nonoverlapping(addr, &mut pnl.daddr.pfa.v6, mem::size_of_val(&pnl.daddr.pfa.v6)); pnl.set_dport(port); } @@ -194,6 +196,7 @@ impl PacketFilter { let addr: *const libc::in_addr = &((*sockaddr).sin_addr) as *const _; let port: libc::in_port_t = (*sockaddr).sin_port; + #[allow(clippy::size_of_in_element_count)] ptr::copy_nonoverlapping(addr, &mut pnl.saddr.pfa.v4, mem::size_of_val(&pnl.saddr.pfa.v4)); pnl.set_sport(port); } @@ -208,6 +211,7 @@ impl PacketFilter { let addr: *const libc::in6_addr = &((*sockaddr).sin6_addr) as *const _; let port: libc::in_port_t = (*sockaddr).sin6_port; + #[allow(clippy::size_of_in_element_count)] ptr::copy_nonoverlapping(addr, &mut pnl.saddr.pfa.v6, mem::size_of_val(&pnl.saddr.pfa.v6)); pnl.set_sport(port); } @@ -229,6 +233,7 @@ impl PacketFilter { let dst_addr: &mut libc::sockaddr_in = &mut *(dst_addr as *mut _); dst_addr.sin_family = pnl.af; dst_addr.sin_port = pnl.rdport(); + #[allow(clippy::size_of_in_element_count)] ptr::copy_nonoverlapping( &pnl.rdaddr.pfa.v4, &mut dst_addr.sin_addr, @@ -239,6 +244,7 @@ impl PacketFilter { let dst_addr: &mut libc::sockaddr_in6 = &mut *(dst_addr as *mut _); dst_addr.sin6_family = pnl.af; dst_addr.sin6_port = pnl.rdport(); + #[allow(clippy::size_of_in_element_count)] ptr::copy_nonoverlapping( &pnl.rdaddr.pfa.v6, &mut dst_addr.sin6_addr, diff --git a/crates/shadowsocks-service/src/local/redir/udprelay/mod.rs b/crates/shadowsocks-service/src/local/redir/udprelay/mod.rs index b081f27bdf15..44f4528254bc 100644 --- a/crates/shadowsocks-service/src/local/redir/udprelay/mod.rs +++ b/crates/shadowsocks-service/src/local/redir/udprelay/mod.rs @@ -130,6 +130,7 @@ impl UdpRedir { self.redir_ty, local_addr ); + #[allow(clippy::needless_update)] let manager = UdpAssociationManager::new( self.context.clone(), UdpRedirInboundWriter { diff --git a/crates/shadowsocks-service/src/local/socks/client/socks5/udp_client.rs b/crates/shadowsocks-service/src/local/socks/client/socks5/udp_client.rs index 6d3dced77b52..17413903b9f3 100644 --- a/crates/shadowsocks-service/src/local/socks/client/socks5/udp_client.rs +++ b/crates/shadowsocks-service/src/local/socks/client/socks5/udp_client.rs @@ -96,7 +96,7 @@ impl Socks5UdpClient { fn check_associated(&self) -> io::Result<()> { if self.assoc_client.is_none() { let err = io::Error::new(ErrorKind::Other, "udp not associated"); - return Err(err.into()); + return Err(err); } Ok(()) } diff --git a/crates/shadowsocks-service/src/local/socks/server/mod.rs b/crates/shadowsocks-service/src/local/socks/server/mod.rs index b2fd11e66f3f..9969a7d2c6a2 100644 --- a/crates/shadowsocks-service/src/local/socks/server/mod.rs +++ b/crates/shadowsocks-service/src/local/socks/server/mod.rs @@ -27,6 +27,12 @@ pub struct Socks { nodelay: bool, } +impl Default for Socks { + fn default() -> Self { + Socks::new() + } +} + impl Socks { /// Create a new SOCKS server with default configuration pub fn new() -> Socks { @@ -113,10 +119,8 @@ impl Socks { let udp_bind_addr = self.udp_bind_addr.as_ref().unwrap_or(client_config); let udp_bind_addr = Arc::new(udp_bind_addr.clone()); Some(udp_bind_addr) - } else if let Some(ref ua) = self.udp_bind_addr { - Some(Arc::new(ua.clone())) } else { - None + self.udp_bind_addr.clone().map(Arc::new) }; loop { diff --git a/crates/shadowsocks-service/src/manager/server.rs b/crates/shadowsocks-service/src/manager/server.rs index f18946c96af7..891cccbd1eec 100644 --- a/crates/shadowsocks-service/src/manager/server.rs +++ b/crates/shadowsocks-service/src/manager/server.rs @@ -194,7 +194,7 @@ impl Manager { ); } - let flow_stat = server.flow_stat().clone(); + let flow_stat = server.flow_stat(); let (server_fut, abortable) = future::abortable(async move { server.run().await }); tokio::spawn(server_fut); diff --git a/crates/shadowsocks-service/src/net/flow.rs b/crates/shadowsocks-service/src/net/flow.rs index ba36d0e3b069..bfd2a74a9200 100644 --- a/crates/shadowsocks-service/src/net/flow.rs +++ b/crates/shadowsocks-service/src/net/flow.rs @@ -13,14 +13,20 @@ pub struct FlowStat { rx: FlowCounter, } -impl FlowStat { - /// Create an empty flow statistic - pub fn new() -> FlowStat { +impl Default for FlowStat { + fn default() -> Self { FlowStat { tx: FlowCounter::new(0), rx: FlowCounter::new(0), } } +} + +impl FlowStat { + /// Create an empty flow statistic + pub fn new() -> FlowStat { + FlowStat::default() + } /// Transmitted bytes count #[cfg(not(any(target_arch = "mips", target_arch = "powerpc")))] diff --git a/crates/shadowsocks-service/src/server/context.rs b/crates/shadowsocks-service/src/server/context.rs index 185ab20f7204..53fd835e5ad1 100644 --- a/crates/shadowsocks-service/src/server/context.rs +++ b/crates/shadowsocks-service/src/server/context.rs @@ -24,9 +24,8 @@ pub struct ServiceContext { flow_stat: Arc, } -impl ServiceContext { - /// Create a new `ServiceContext` - pub fn new() -> ServiceContext { +impl Default for ServiceContext { + fn default() -> Self { ServiceContext { context: Context::new_shared(ServerType::Server), connect_opts: ConnectOpts::default(), @@ -34,6 +33,13 @@ impl ServiceContext { flow_stat: Arc::new(FlowStat::new()), } } +} + +impl ServiceContext { + /// Create a new `ServiceContext` + pub fn new() -> ServiceContext { + ServiceContext::default() + } /// Get cloned `shadowsocks` Context pub fn context(&self) -> SharedContext { diff --git a/crates/shadowsocks-service/src/server/mod.rs b/crates/shadowsocks-service/src/server/mod.rs index eaefa87ea236..5a56f4246e43 100644 --- a/crates/shadowsocks-service/src/server/mod.rs +++ b/crates/shadowsocks-service/src/server/mod.rs @@ -22,7 +22,7 @@ mod udprelay; /// Starts a shadowsocks server pub async fn run(config: Config) -> io::Result<()> { assert_eq!(config.config_type, ConfigType::Server); - assert!(config.server.len() > 0); + assert!(!config.server.is_empty()); trace!("{:?}", config); @@ -69,10 +69,9 @@ pub async fn run(config: Config) -> io::Result<()> { accept_opts.tcp.recv_buffer_size = config.inbound_recv_buffer_size; accept_opts.tcp.nodelay = config.no_delay; - let resolver = match build_dns_resolver(config.dns, config.ipv6_first, &connect_opts).await { - Some(resolver) => Some(Arc::new(resolver)), - None => None, - }; + let resolver = build_dns_resolver(config.dns, config.ipv6_first, &connect_opts) + .await + .map(Arc::new); let acl = config.acl.map(Arc::new); diff --git a/crates/shadowsocks-service/src/server/udprelay.rs b/crates/shadowsocks-service/src/server/udprelay.rs index 1ca2044d3935..badc292ed7b0 100644 --- a/crates/shadowsocks-service/src/server/udprelay.rs +++ b/crates/shadowsocks-service/src/server/udprelay.rs @@ -300,7 +300,7 @@ impl UdpAssociationContext { let socket = OutboundUdpSocket::connect_any_with_opts(&target_addr, self.context.connect_opts_ref()).await?; - let socket: Arc = Arc::new(socket.into()); + let socket: Arc = Arc::new(socket); let (r2l_fut, r2l_abortable) = { let assoc = self.clone(); @@ -355,7 +355,7 @@ impl UdpAssociationContext { let socket = OutboundUdpSocket::connect_any_with_opts(&target_addr, self.context.connect_opts_ref()).await?; - let socket: Arc = Arc::new(socket.into()); + let socket: Arc = Arc::new(socket); let (r2l_fut, r2l_abortable) = { let assoc = self.clone();