perf: enable TCP_NODELAY on gRPC servers
This change forces TCP_NODELAY to be set, which is the default for tonic, and is enabled by default, but is silently discarded when using serve_with_incoming_shutdown().pull/24376/head
parent
6e1d371460
commit
6523004008
|
@ -130,7 +130,6 @@ macro_rules! setup_builder {
|
|||
#[macro_export]
|
||||
macro_rules! serve_builder {
|
||||
($builder:ident) => {{
|
||||
use $crate::reexport::tokio_stream::wrappers::TcpListenerStream;
|
||||
use $crate::rpc::RpcBuilder;
|
||||
|
||||
let RpcBuilder {
|
||||
|
@ -140,7 +139,10 @@ macro_rules! serve_builder {
|
|||
..
|
||||
} = $builder;
|
||||
|
||||
let stream = TcpListenerStream::new(socket);
|
||||
let stream = $crate::reexport::tonic::transport::server::TcpIncoming::from_listener(
|
||||
socket, true, None,
|
||||
)
|
||||
.expect("failed to initialise tcp socket");
|
||||
inner
|
||||
.serve_with_incoming_shutdown(stream, shutdown.cancelled())
|
||||
.await?;
|
||||
|
|
Loading…
Reference in New Issue