File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -206,6 +206,11 @@ impl Socket {
206
206
std:: mem:: forget ( s) ;
207
207
result
208
208
}
209
+
210
+ pub fn set_nodelay ( & self , nodelay : bool ) -> io:: Result < ( ) > {
211
+ let socket_ref = socket2:: SockRef :: from ( self ) ;
212
+ socket_ref. set_nodelay ( nodelay)
213
+ }
209
214
}
210
215
211
216
impl AsRawFd for Socket {
Original file line number Diff line number Diff line change @@ -207,6 +207,16 @@ impl TcpStream {
207
207
pub fn shutdown ( & self , how : std:: net:: Shutdown ) -> io:: Result < ( ) > {
208
208
self . inner . shutdown ( how)
209
209
}
210
+
211
+ /// Sets the value of the TCP_NODELAY option on this socket.
212
+ ///
213
+ /// If set, this option disables the Nagle algorithm. This means that segments are always sent
214
+ /// as soon as possible, even if there is only a small amount of data. When not set, data is
215
+ /// buffered until there is a sufficient amount to send out, thereby avoiding the frequent
216
+ /// sending of small packets.
217
+ pub fn set_nodelay ( & self , nodelay : bool ) -> io:: Result < ( ) > {
218
+ self . inner . set_nodelay ( nodelay)
219
+ }
210
220
}
211
221
212
222
impl FromRawFd for TcpStream {
You can’t perform that action at this time.
0 commit comments