Skip to content

Commit f274d98

Browse files
OmmyZhangJens-G
authored andcommitted
enable TCP_NODELAY for rust client channel
1 parent 32b80f6 commit f274d98

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/rs/src/transport/socket.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ use crate::{new_transport_error, TransportErrorKind};
5252
/// use thrift::transport::TTcpChannel;
5353
///
5454
/// let stream = TcpStream::connect("127.0.0.1:9189").unwrap();
55+
/// stream.set_nodelay(true).unwrap();
5556
///
5657
/// // no need to call c.open() since we've already connected above
5758
/// let mut c = TTcpChannel::with_stream(stream);
@@ -94,6 +95,7 @@ impl TTcpChannel {
9495
} else {
9596
match TcpStream::connect(&remote_address) {
9697
Ok(s) => {
98+
s.set_nodelay(true)?;
9799
self.stream = Some(s);
98100
Ok(())
99101
}

0 commit comments

Comments
 (0)