File tree 1 file changed +12
-2
lines changed
library/std/src/os/unix/net
1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -73,8 +73,18 @@ impl UnixListener {
73
73
unsafe {
74
74
let inner = Socket :: new_raw ( libc:: AF_UNIX , libc:: SOCK_STREAM ) ?;
75
75
let ( addr, len) = sockaddr_un ( path. as_ref ( ) ) ?;
76
- const backlog: libc:: c_int =
77
- if cfg ! ( any( target_os = "linux" , target_os = "freebsd" ) ) { -1 } else { 128 } ;
76
+ #[ cfg( any( target_os = "windows" , target_os = "redox" ) ) ]
77
+ const backlog: libc:: c_int = 128 ;
78
+ #[ cfg( any( target_os = "linux" , target_os = "freebsd" , target_os = "openbsd" ) ) ]
79
+ const backlog: libc:: c_int = -1 ;
80
+ #[ cfg( not( any(
81
+ target_os = "windows" ,
82
+ target_os = "redox" ,
83
+ target_os = "linux" ,
84
+ target_os = "freebsd" ,
85
+ target_os = "openbsd"
86
+ ) ) ) ]
87
+ const backlog: libc:: c_int = libc:: SOMAXCONN ;
78
88
79
89
cvt ( libc:: bind ( inner. as_inner ( ) . as_raw_fd ( ) , & addr as * const _ as * const _ , len as _ ) ) ?;
80
90
cvt ( libc:: listen ( inner. as_inner ( ) . as_raw_fd ( ) , backlog) ) ?;
You can’t perform that action at this time.
0 commit comments