Skip to content

Commit

Permalink
📝 add tcp nodelay
Browse files Browse the repository at this point in the history
  • Loading branch information
Xudong-Huang committed Jun 19, 2024
1 parent 5729b07 commit a51fc74
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions examples/throughput.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions src/conetty/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit a51fc74

Please sign in to comment.