diff --git a/examples/throughput.rs b/examples/throughput.rs index e79b278..4a1d4a3 100644 --- a/examples/throughput.rs +++ b/examples/throughput.rs @@ -29,6 +29,7 @@ fn main() { let clients: Vec<_> = (0..total_client) .map(|_| { let stream = may::net::TcpStream::connect(addr).unwrap(); + stream.set_nodelay(true).unwrap(); RpcClient::new(stream).unwrap() }) .collect(); diff --git a/src/conetty/server.rs b/src/conetty/server.rs index 091da54..bf45c62 100644 --- a/src/conetty/server.rs +++ b/src/conetty/server.rs @@ -112,6 +112,7 @@ pub trait TcpServer: Server { let manager = Manager::new(); for stream in listener.incoming() { let stream = t!(stream); + stream.set_nodelay(true).unwrap(); let server = server.clone(); manager.add(move |_| { let rs = stream.try_clone().expect("failed to clone stream");