diff --git a/tonic/src/transport/server.rs b/tonic/src/transport/server.rs index 886a74b7e..9d1da6076 100644 --- a/tonic/src/transport/server.rs +++ b/tonic/src/transport/server.rs @@ -427,7 +427,8 @@ struct TcpIncoming { impl TcpIncoming { fn bind(addr: SocketAddr) -> Result { - let inner = conn::AddrIncoming::bind(&addr).map_err(Box::new)?; + let mut inner = conn::AddrIncoming::bind(&addr).map_err(Box::new)?; + inner.set_nodelay(true); Ok(Self { inner }) } diff --git a/tonic/src/transport/service/connector.rs b/tonic/src/transport/service/connector.rs index 908c5b7aa..c02d17367 100644 --- a/tonic/src/transport/service/connector.rs +++ b/tonic/src/transport/service/connector.rs @@ -13,6 +13,7 @@ use tower_service::Service; pub(crate) fn connector() -> HttpConnector { let mut http = HttpConnector::new(); http.enforce_http(false); + http.set_nodelay(true); http } @@ -32,6 +33,7 @@ impl Connector { pub(crate) fn new(tls: Option) -> Self { let mut http = HttpConnector::new(); http.enforce_http(false); + http.set_nodelay(true); Self { http, tls } }