Skip to content

Commit f9e738f

Browse files
committed
Put Socket::set_nosigpipe behind the all feature
It's only available on Apple platforms.
1 parent afe4ed7 commit f9e738f

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/sys/unix.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,7 @@ pub(crate) fn accept(fd: SysSocket) -> io::Result<(SysSocket, SockAddr)> {
331331
})
332332
}
333333

334+
/// Unix only API.
334335
impl crate::Socket {
335336
/// Accept a new incoming connection from this listener.
336337
///
@@ -381,8 +382,12 @@ impl crate::Socket {
381382
fcntl_add(self.inner, libc::FD_CLOEXEC)
382383
}
383384

384-
/// Sets `SO_NOSIGPIPE` to one.
385-
#[cfg(target_vendor = "apple")]
385+
/// Sets `SO_NOSIGPIPE` on the socket.
386+
///
387+
/// # Notes
388+
///
389+
/// Only supported on Apple platforms (`target_vendor = "apple"`).
390+
#[cfg(all(feature = "all", target_vendor = "apple"))]
386391
pub fn set_nosigpipe(&self) -> io::Result<()> {
387392
unsafe { setsockopt(self.inner, libc::SOL_SOCKET, libc::SO_NOSIGPIPE, 1i32) }
388393
}
@@ -399,7 +404,7 @@ fn fcntl_add(fd: SysSocket, flag: c_int) -> io::Result<()> {
399404
}
400405
}
401406

402-
#[cfg(target_vendor = "apple")]
407+
#[cfg(all(feature = "all", target_vendor = "apple"))]
403408
unsafe fn setsockopt<T>(fd: SysSocket, opt: c_int, val: c_int, payload: T) -> io::Result<()>
404409
where
405410
T: Copy,

0 commit comments

Comments
 (0)