File tree 1 file changed +11
-0
lines changed
library/std/src/sys/net/connection/socket
1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -424,6 +424,7 @@ impl Socket {
424
424
Ok ( ( ) )
425
425
}
426
426
427
+ #[ cfg( not( target_os = "cygwin" ) ) ]
427
428
pub fn set_linger ( & self , linger : Option < Duration > ) -> io:: Result < ( ) > {
428
429
let linger = libc:: linger {
429
430
l_onoff : linger. is_some ( ) as libc:: c_int ,
@@ -433,6 +434,16 @@ impl Socket {
433
434
setsockopt ( self , libc:: SOL_SOCKET , SO_LINGER , linger)
434
435
}
435
436
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
+
436
447
pub fn linger ( & self ) -> io:: Result < Option < Duration > > {
437
448
let val: libc:: linger = getsockopt ( self , libc:: SOL_SOCKET , SO_LINGER ) ?;
438
449
You can’t perform that action at this time.
0 commit comments