File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
library/std/src/sys/net/connection/socket Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -424,6 +424,7 @@ impl Socket {
424424 Ok ( ( ) )
425425 }
426426
427+ #[ cfg( not( target_os = "cygwin" ) ) ]
427428 pub fn set_linger ( & self , linger : Option < Duration > ) -> io:: Result < ( ) > {
428429 let linger = libc:: linger {
429430 l_onoff : linger. is_some ( ) as libc:: c_int ,
@@ -433,6 +434,16 @@ impl Socket {
433434 setsockopt ( self , libc:: SOL_SOCKET , SO_LINGER , linger)
434435 }
435436
437+ #[ cfg( target_os = "cygwin" ) ]
438+ pub fn set_linger ( & self , linger : Option < Duration > ) -> io:: Result < ( ) > {
439+ let linger = libc:: linger {
440+ l_onoff : linger. is_some ( ) as libc:: c_ushort ,
441+ l_linger : linger. unwrap_or_default ( ) . as_secs ( ) as libc:: c_ushort ,
442+ } ;
443+
444+ setsockopt ( self , libc:: SOL_SOCKET , SO_LINGER , linger)
445+ }
446+
436447 pub fn linger ( & self ) -> io:: Result < Option < Duration > > {
437448 let val: libc:: linger = getsockopt ( self , libc:: SOL_SOCKET , SO_LINGER ) ?;
438449
You can’t perform that action at this time.
0 commit comments