Skip to content

Commit

Permalink
TODO: TX_TIME is invalid for some reason
Browse files Browse the repository at this point in the history
  • Loading branch information
evanrittenhouse committed May 10, 2024
1 parent 0b19199 commit 1b4ed63
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions dgram/src/syscalls.rs
Expand Up @@ -63,6 +63,7 @@ pub fn send_msg(
cmsgs.push(ControlMessage::TxTime(&raw_time));
}

let client_addr = dst.map(SockaddrStorage::from);
raw_send_to(
&fd.as_fd(),
send_buf,
Expand All @@ -76,8 +77,9 @@ pub fn send_msg(
#[cfg(target_os = "linux")]
pub fn send_with_cmsgs(

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

View workflow job for this annotation

GitHub Actions / quiche

function `send_with_cmsgs` is never used

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

View workflow job for this annotation

GitHub Actions / quiche

function `send_with_cmsgs` is never used

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

View workflow job for this annotation

GitHub Actions / quiche (boringssl-boring-crate)

function `send_with_cmsgs` is never used

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

View workflow job for this annotation

GitHub Actions / quiche_multiarch (armv7-unknown-linux-gnueabihf)

function `send_with_cmsgs` is never used

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

View workflow job for this annotation

GitHub Actions / quiche_multiarch (i686-unknown-linux-gnu)

function `send_with_cmsgs` is never used
fd: impl AsFd, send_buf: &[u8], cmsgs: &[ControlMessage],
client_addr: &SockaddrStorage,
dst: Option<SocketAddr>,
) -> SyscallResult<usize> {
let client_addr = dst.map(SockaddrStorage::from);
raw_send_to(&fd.as_fd(), send_buf, cmsgs, MsgFlags::empty(), client_addr)
}

Expand Down Expand Up @@ -160,6 +162,19 @@ pub fn recv_msg(
}
}

fn std_time_to_u64(time: &Instant) -> u64 {

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

View workflow job for this annotation

GitHub Actions / quiche

function `std_time_to_u64` is never used

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

View workflow job for this annotation

GitHub Actions / quiche

function `std_time_to_u64` is never used

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

View workflow job for this annotation

GitHub Actions / quiche (boringssl-boring-crate)

function `std_time_to_u64` is never used

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

View workflow job for this annotation

GitHub Actions / quiche_multiarch (armv7-unknown-linux-gnueabihf)

function `std_time_to_u64` is never used

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

View workflow job for this annotation

GitHub Actions / quiche_multiarch (i686-unknown-linux-gnu)

function `std_time_to_u64` is never used
const NANOS_PER_SEC: u64 = 1_000_000_000;
const INSTANT_ZERO: std::time::Instant =
unsafe { std::mem::transmute(std::time::UNIX_EPOCH) };

let raw_time = time.duration_since(INSTANT_ZERO);

let sec = raw_time.as_secs();
let nsec = raw_time.subsec_nanos();

sec * NANOS_PER_SEC + nsec as u64
}

#[cfg(all(test, target_os = "linux", not(target_os = "android")))]
mod tests {
use nix::cmsg_space;
Expand Down Expand Up @@ -315,7 +330,7 @@ mod tests {

send_msg(send, send_buf, SendMsgCmsgSettings {
segment_size: None,
tx_time: Some(Instant::now() + std::time::Duration::from_millis(5)),
tx_time: Some(Instant::now() + std::time::Duration::from_secs(5)),
dst: addr,
})?;

Expand Down

0 comments on commit 1b4ed63

Please sign in to comment.