Skip to content

Commit

Permalink
try to fix build on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
zh-jq-b committed Nov 2, 2023
1 parent 2b93b41 commit 3ef6fcd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/g3-io-ext/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ memchr.workspace = true
fastrand.workspace = true
bytes.workspace = true
ahash.workspace = true
nix = { workspace = true, features = ["net"] }
nix = { workspace = true, features = ["net", "uio"] }
g3-types.workspace = true
g3-resolver.workspace = true

Expand Down
14 changes: 6 additions & 8 deletions lib/g3-io-ext/src/udp/split.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,19 +94,17 @@ impl AsyncUdpSend for SendHalf {
iov: &[IoSlice<'_>],
target: Option<SocketAddr>,
) -> Poll<io::Result<usize>> {
#[cfg(not(target_os = "macos"))]
let flags: MsgFlags = MsgFlags::MSG_DONTWAIT | MsgFlags::MSG_NOSIGNAL;
#[cfg(target_os = "macos")]
let flags: MsgFlags = MsgFlags::MSG_DONTWAIT;

let raw_fd = self.0.as_raw_fd();
let addr = target.map(SockaddrStorage::from);
loop {
ready!(self.0.poll_send_ready(cx))?;
if let Ok(res) = self.0.try_io(Interest::WRITABLE, || {
sendmsg(
raw_fd,
iov,
&[],
MsgFlags::MSG_DONTWAIT | MsgFlags::MSG_NOSIGNAL,
addr.as_ref(),
)
.map_err(io::Error::from)
sendmsg(raw_fd, iov, &[], flags, addr.as_ref()).map_err(io::Error::from)
}) {
return Poll::Ready(Ok(res));
}
Expand Down

0 comments on commit 3ef6fcd

Please sign in to comment.