Skip to content

Commit d4b1057

Browse files
Max Lvzonyitoo
Max Lv
authored andcommitted
Remove the reuse for UNIX stream DNS lookup.
Our UNIX stream based DNS lookup doesn't support connection reuse.
1 parent 4f6035a commit d4b1057

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

crates/shadowsocks-service/src/local/dns/client_cache.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! DNS Client cache
22
33
#[cfg(unix)]
4-
use std::path::{Path, PathBuf};
4+
use std::path::Path;
55
use std::{
66
collections::{hash_map::Entry, HashMap, VecDeque},
77
future::Future,
@@ -23,8 +23,6 @@ use super::upstream::DnsClient;
2323
enum DnsClientKey {
2424
TcpLocal(SocketAddr),
2525
UdpLocal(SocketAddr),
26-
#[cfg(unix)]
27-
UnixStream(PathBuf),
2826
TcpRemote(Address),
2927
UdpRemote(Address),
3028
}
@@ -124,12 +122,8 @@ impl DnsClientCache {
124122
pub async fn lookup_unix_stream<P: AsRef<Path>>(&self, ns: &P, msg: Message) -> Result<Message, ProtoError> {
125123
let mut last_err = None;
126124

127-
let key = DnsClientKey::UnixStream(ns.as_ref().to_path_buf());
128125
for _ in 0..self.retry_count {
129-
let mut client = match self
130-
.get_client_or_create(&key, async { DnsClient::connect_unix_stream(ns).await })
131-
.await
132-
{
126+
let mut client = match DnsClient::connect_unix_stream(ns).await {
133127
Ok(client) => client,
134128
Err(err) => {
135129
last_err = Some(From::from(err));
@@ -145,8 +139,6 @@ impl DnsClientCache {
145139
}
146140
};
147141

148-
self.save_client(key, client).await;
149-
150142
return Ok(res);
151143
}
152144

0 commit comments

Comments
 (0)