File tree 2 files changed +6
-12
lines changed
2 files changed +6
-12
lines changed Original file line number Diff line number Diff line change @@ -28,14 +28,6 @@ use libc::SOCK_CLOEXEC;
28
28
#[ cfg( not( target_os = "linux" ) ) ]
29
29
const SOCK_CLOEXEC : c_int = 0 ;
30
30
31
- // Another conditional constant for name resolution: Macos et iOS use
32
- // SO_NOSIGPIPE as a setsockopt flag to disable SIGPIPE emission on socket.
33
- // Other platforms do otherwise.
34
- #[ cfg( target_vendor = "apple" ) ]
35
- use libc:: SO_NOSIGPIPE ;
36
- #[ cfg( not( target_vendor = "apple" ) ) ]
37
- const SO_NOSIGPIPE : c_int = 0 ;
38
-
39
31
pub struct Socket ( FileDesc ) ;
40
32
41
33
pub fn init ( ) { }
@@ -89,9 +81,12 @@ impl Socket {
89
81
let fd = FileDesc :: new ( fd) ;
90
82
fd. set_cloexec ( ) ?;
91
83
let socket = Socket ( fd) ;
92
- if cfg ! ( target_vendor = "apple" ) {
93
- setsockopt ( & socket, libc:: SOL_SOCKET , SO_NOSIGPIPE , 1 ) ?;
94
- }
84
+
85
+ // macOS and iOS use `SO_NOSIGPIPE` as a `setsockopt`
86
+ // flag to disable `SIGPIPE` emission on socket.
87
+ #[ cfg( target_vendor = "apple" ) ]
88
+ setsockopt ( & socket, libc:: SOL_SOCKET , libc:: SO_NOSIGPIPE , 1 ) ?;
89
+
95
90
Ok ( socket)
96
91
}
97
92
}
Original file line number Diff line number Diff line change @@ -19,7 +19,6 @@ pub extern crate libc as netc;
19
19
pub type wrlen_t = size_t ;
20
20
21
21
const SOCK_CLOEXEC : c_int = 0 ;
22
- const SO_NOSIGPIPE : c_int = 0 ;
23
22
24
23
pub struct Socket ( FileDesc ) ;
25
24
You can’t perform that action at this time.
0 commit comments