Skip to content

Commit

Permalink
Set TCP_NODELAY to true
Browse files Browse the repository at this point in the history
  • Loading branch information
kiron1 committed May 19, 2024
1 parent df87fae commit 8935d09
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions detox_hyper/src/conn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ impl std::future::IntoFuture for ConnectionBuilder {
match self.kind {
Http(dst) => async move {
let stream = TcpStream::connect(dst.to_pair()).await?;
stream.set_nodelay(true)?;
if let Some(ka) = self.tcp_keepalive {
ka.apply(&stream)?;
}
Expand All @@ -270,6 +271,7 @@ impl std::future::IntoFuture for ConnectionBuilder {
.boxed(),
Https(dst, tls_config) => async move {
let stream = TcpStream::connect(dst.to_pair()).await?;
stream.set_nodelay(true)?;
if let Some(ka) = self.tcp_keepalive {
ka.apply(&stream)?;
}
Expand Down Expand Up @@ -297,6 +299,7 @@ impl std::future::IntoFuture for ConnectionBuilder {
))
})?;
let stream = TcpStream::connect(proxy.to_pair()).await?;
stream.set_nodelay(true)?;
if let Some(ka) = self.tcp_keepalive {
ka.apply(&stream)?;
}
Expand All @@ -315,6 +318,7 @@ impl std::future::IntoFuture for ConnectionBuilder {
))
})?;
let stream = TcpStream::connect(proxy.to_pair()).await?;
stream.set_nodelay(true)?;
if let Some(ka) = self.tcp_keepalive {
ka.apply(&stream)?;
}
Expand All @@ -338,6 +342,7 @@ impl std::future::IntoFuture for ConnectionBuilder {
HttpTunnel(proxy, tls_config, auth, dst) => match proxy {
Proxy::Http(proxy) => async move {
let stream = TcpStream::connect(proxy.to_pair()).await?;
stream.set_nodelay(true)?;
if let Some(ka) = self.tcp_keepalive {
ka.apply(&stream)?;
}
Expand All @@ -352,6 +357,7 @@ impl std::future::IntoFuture for ConnectionBuilder {
.boxed(),
Proxy::Https(proxy) => async move {
let stream = TcpStream::connect(proxy.to_pair()).await?;
stream.set_nodelay(true)?;
if let Some(ka) = self.tcp_keepalive {
ka.apply(&stream)?;
}
Expand Down

0 comments on commit 8935d09

Please sign in to comment.