mirror of
https://github.com/shadowsocks/shadowsocks-rust.git
synced 2026-11-15 08:15:31 +00:00
add set no delay
This commit is contained in:
+2
-2
@@ -220,7 +220,7 @@ impl Config {
|
|||||||
Some(t) => Some(try!(t.as_u64()
|
Some(t) => Some(try!(t.as_u64()
|
||||||
.ok_or(Error::new(ErrorKind::Malformed,
|
.ok_or(Error::new(ErrorKind::Malformed,
|
||||||
"`timeout` should be an integer",
|
"`timeout` should be an integer",
|
||||||
None))) as u32 * 1000),
|
None))) as u32),
|
||||||
None => None,
|
None => None,
|
||||||
},
|
},
|
||||||
dns_cache_capacity: match server.find("dns_cache_capacity") {
|
dns_cache_capacity: match server.find("dns_cache_capacity") {
|
||||||
@@ -285,7 +285,7 @@ impl Config {
|
|||||||
Some(t) => Some(try!(t.as_u64()
|
Some(t) => Some(try!(t.as_u64()
|
||||||
.ok_or(Error::new(ErrorKind::Malformed,
|
.ok_or(Error::new(ErrorKind::Malformed,
|
||||||
"`timeout` should be an integer",
|
"`timeout` should be an integer",
|
||||||
None))) as u32 * 1000),
|
None))) as u32),
|
||||||
None => None,
|
None => None,
|
||||||
},
|
},
|
||||||
dns_cache_capacity: match o.get("dns_cache_capacity") {
|
dns_cache_capacity: match o.get("dns_cache_capacity") {
|
||||||
|
|||||||
@@ -322,7 +322,15 @@ impl Relay for TcpRelayLocal {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let _ = stream.set_keepalive(self.config.timeout);
|
if let Err(err) = stream.set_keepalive(self.config.timeout) {
|
||||||
|
error!("Failed to set keep alive: {:?}", err);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if let Err(err) = stream.set_nodelay(true) {
|
||||||
|
error!("Failed to set no delay: {:?}", err);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
let mut succeed = false;
|
let mut succeed = false;
|
||||||
for _ in 0..server_load_balancer.total() {
|
for _ in 0..server_load_balancer.total() {
|
||||||
|
|||||||
@@ -70,7 +70,15 @@ impl TcpRelayServer {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let _ = stream.set_keepalive(timeout);
|
if let Err(err) = stream.set_keepalive(timeout) {
|
||||||
|
error!("Failed to set keep alive: {:?}", err);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if let Err(err) = stream.set_nodelay(true) {
|
||||||
|
error!("Failed to set no delay: {:?}", err);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
let pwd = pwd.clone();
|
let pwd = pwd.clone();
|
||||||
let encrypt_method = method;
|
let encrypt_method = method;
|
||||||
|
|||||||
Reference in New Issue
Block a user