optimize the condition of enabling kcp (#1210)

This commit is contained in:
Sijie.Sun
2025-08-09 16:16:09 +08:00
committed by GitHub
parent 37b24164b6
commit 8ffc2f12e4
11 changed files with 110 additions and 18 deletions
+9 -1
View File
@@ -751,8 +751,16 @@ impl Socks5Server {
continue;
};
let Some(peer_mgr_arc) = peer_mgr.upgrade() else {
tracing::error!("peer manager is dropped");
continue;
};
let dst_allow_kcp = peer_mgr_arc.check_allow_kcp_to_dst(&dst_addr.ip()).await;
tracing::debug!("dst_allow_kcp: {:?}", dst_allow_kcp);
let connector: Box<dyn AsyncTcpConnector<S = SocksTcpStream> + Send> =
if kcp_endpoint.is_none() {
if kcp_endpoint.is_none() || !dst_allow_kcp {
Box::new(SmolTcpConnector {
net: net.smoltcp_net.clone(),
entries: entries.clone(),