File tree 1 file changed +19
-0
lines changed
1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -231,6 +231,25 @@ impl TcpStream {
231
231
pub fn into_poll_fd ( self ) -> io:: Result < PollFd < Socket2 > > {
232
232
self . inner . into_poll_fd ( )
233
233
}
234
+
235
+ /// Gets the value of the `TCP_NODELAY` option on this socket.
236
+ ///
237
+ /// For more information about this option, see
238
+ /// [`TcpStream::set_nodelay`].
239
+ pub fn nodelay ( & self ) -> io:: Result < bool > {
240
+ self . inner . socket . nodelay ( )
241
+ }
242
+
243
+ /// Sets the value of the TCP_NODELAY option on this socket.
244
+ ///
245
+ /// If set, this option disables the Nagle algorithm. This means
246
+ /// that segments are always sent as soon as possible, even if
247
+ /// there is only a small amount of data. When not set, data is
248
+ /// buffered until there is a sufficient amount to send out,
249
+ /// thereby avoiding the frequent sending of small packets.
250
+ pub fn set_nodelay ( & self , nodelay : bool ) -> io:: Result < ( ) > {
251
+ self . inner . socket . set_nodelay ( nodelay)
252
+ }
234
253
}
235
254
236
255
impl AsyncRead for TcpStream {
You can’t perform that action at this time.
0 commit comments