Skip to content

Commit

Permalink
Fix MacOS CI
Browse files Browse the repository at this point in the history
  • Loading branch information
evanrittenhouse committed Apr 24, 2024
1 parent f73a965 commit e1ae9c5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
6 changes: 3 additions & 3 deletions dgram/src/async_socket.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
use crate::syscalls::RecvData;
use std::io::ErrorKind;
use std::io::Result;
use std::net::SocketAddr;
use std::os::fd::AsRawFd;
use std::time::Instant;
use tokio::net::UdpSocket;

Expand All @@ -12,6 +10,8 @@ mod linux_imports {
pub(super) use crate::syscalls::send_msg;
pub(super) use nix::sys::socket::MsgFlags;
pub(super) use nix::sys::socket::SockaddrStorage;
pub(super) use std::io::ErrorKind;
pub(super) use std::os::fd::AsRawFd;
pub(super) use tokio::io::Interest;
}

Expand Down Expand Up @@ -73,7 +73,7 @@ pub async fn recv_from(
pub async fn send_to(
socket: &tokio::net::UdpSocket, client_addr: SocketAddr, send_buf: &[u8],
_segment_size: usize, _num_pkts: usize, _tx_time: Option<Instant>,
) -> io::Result<usize> {
) -> Result<usize> {
socket.send_to(send_buf, client_addr).await
}

Expand Down
20 changes: 11 additions & 9 deletions dgram/src/syscalls.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
use std::io::IoSlice;
use std::io::IoSliceMut;
use std::io::Result;
use nix::sys::socket::ControlMessageOwned;

Check failure on line 1 in dgram/src/syscalls.rs

View workflow job for this annotation

GitHub Actions / quiche_windows (x86_64-pc-windows-msvc)

failed to resolve: could not find `sys` in `nix`

Check failure on line 1 in dgram/src/syscalls.rs

View workflow job for this annotation

GitHub Actions / quiche_windows (i686-pc-windows-msvc)

failed to resolve: could not find `sys` in `nix`
use std::net::SocketAddr;
use std::net::SocketAddrV4;
use std::net::SocketAddrV6;
use std::os::fd::AsRawFd;
use std::time::Instant;

Check failure on line 3 in dgram/src/syscalls.rs

View workflow job for this annotation

GitHub Actions / quiche_macos (macos-14)

unused import: `std::time::Instant`

Check failure on line 3 in dgram/src/syscalls.rs

View workflow job for this annotation

GitHub Actions / quiche_ios (x86_64-apple-ios)

unused import: `std::time::Instant`

Check failure on line 3 in dgram/src/syscalls.rs

View workflow job for this annotation

GitHub Actions / quiche_macos (macos-latest)

unused import: `std::time::Instant`

Check failure on line 3 in dgram/src/syscalls.rs

View workflow job for this annotation

GitHub Actions / android_ndk_lts (aarch64-linux-android)

unused import: `std::time::Instant`

Check failure on line 3 in dgram/src/syscalls.rs

View workflow job for this annotation

GitHub Actions / quiche_ios (aarch64-apple-ios)

unused import: `std::time::Instant`

Check failure on line 3 in dgram/src/syscalls.rs

View workflow job for this annotation

GitHub Actions / android_ndk_lts (armv7-linux-androideabi)

unused import: `std::time::Instant`

Check failure on line 3 in dgram/src/syscalls.rs

View workflow job for this annotation

GitHub Actions / android_ndk_lts (x86_64-linux-android)

unused import: `std::time::Instant`

Check failure on line 3 in dgram/src/syscalls.rs

View workflow job for this annotation

GitHub Actions / quiche_windows (x86_64-pc-windows-msvc)

unused import: `std::time::Instant`

Check failure on line 3 in dgram/src/syscalls.rs

View workflow job for this annotation

GitHub Actions / quiche_windows (i686-pc-windows-msvc)

unused import: `std::time::Instant`
use std::time::SystemTime;

Expand All @@ -15,18 +10,24 @@ mod linux_imports {
pub(super) use nix::sys::socket::sendmsg;
pub(super) use nix::sys::socket::AddressFamily;
pub(super) use nix::sys::socket::ControlMessage;
pub(super) use nix::sys::socket::ControlMessageOwned;
pub(super) use nix::sys::socket::MsgFlags;
pub(super) use nix::sys::socket::SockaddrLike;
pub(super) use nix::sys::socket::SockaddrStorage;
pub(super) use smallvec::SmallVec;
pub(super) use std::io::IoSlice;
pub(super) use std::io::IoSliceMut;
pub(super) use std::io::Result;
pub(super) use std::net::SocketAddrV4;
pub(super) use std::net::SocketAddrV6;
pub(super) use std::os::fd::AsRawFd;
}

#[cfg(target_os = "linux")]
use self::linux_imports::*;

// An instant with the value of zero, since [`Instant`] is backed by a version
// of timespec this allows to extract raw values from an [`Instant`]
#[cfg(target_os = "linux")]
const INSTANT_ZERO: Instant = unsafe { std::mem::transmute(0u128) };

#[cfg(target_os = "linux")]
Expand Down Expand Up @@ -94,6 +95,7 @@ impl RecvData {
///
/// It is the caller's responsibility to create and clear the cmsg space. `nix`
/// recommends that the space be created via the `cmsg_space!()` macro.
#[cfg(target_os = "linux")]
pub fn recv_msg(
fd: impl AsRawFd, read_buf: &mut [u8], cmsg_space: &mut Vec<u8>,
msg_flags: Option<MsgFlags>,
Expand All @@ -115,7 +117,7 @@ pub fn recv_msg(

let address = match r.address {
Some(a) => a,
_ => return Err(Errno::EINVAL.into()),
_ => return Err(Errno::EINVAL),
};

let peer_addr = match address.family() {
Expand Down Expand Up @@ -146,7 +148,7 @@ pub fn recv_msg(
}
}

#[cfg(test)]
#[cfg(all(test, target_os = "linux"))]
mod tests {
use nix::cmsg_space;
use nix::sys::socket::sockopt::ReceiveTimestampns;
Expand Down

0 comments on commit e1ae9c5

Please sign in to comment.