feat(client): add Linux ancillary receive metadata
This commit is contained in:
1 parent
40dc41dc39
commit
3ff6a07225
7 files changed
+339
-6
No files matched your search
@@ -1,7 +1,13 @@
|
||||
use std::{io, net::UdpSocket};
|
||||
use std::{
|
||||
io,
|
||||
net::{SocketAddr, UdpSocket},
|
||||
};
|
||||
|
||||
use crate::{metadata::ReceiveMeta, timing::ClientTimestamp};
|
||||
|
||||
#[cfg(all(target_os = "linux", feature = "ancillary"))]
|
||||
mod linux;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub(crate) struct ReceivedDatagram {
|
||||
pub(crate) len: usize,
|
||||
@@ -9,6 +15,7 @@ pub(crate) struct ReceivedDatagram {
|
||||
pub(crate) meta: ReceiveMeta,
|
||||
}
|
||||
|
||||
#[cfg(not(all(target_os = "linux", feature = "ancillary")))]
|
||||
pub(crate) fn recv_datagram(
|
||||
socket: &UdpSocket,
|
||||
buf: &mut [u8],
|
||||
@@ -23,6 +30,27 @@ pub(crate) fn recv_datagram(
|
||||
})
|
||||
}
|
||||
|
||||
#[cfg(all(target_os = "linux", feature = "ancillary"))]
|
||||
pub(crate) fn recv_datagram(
|
||||
socket: &UdpSocket,
|
||||
buf: &mut [u8],
|
||||
) -> Result<ReceivedDatagram, io::Error> {
|
||||
linux::recv_datagram(socket, buf)
|
||||
}
|
||||
|
||||
#[cfg(not(all(target_os = "linux", feature = "ancillary")))]
|
||||
pub(crate) fn configure_receive_metadata(
|
||||
_socket: &UdpSocket,
|
||||
_remote: SocketAddr,
|
||||
) -> io::Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(all(target_os = "linux", feature = "ancillary"))]
|
||||
pub(crate) fn configure_receive_metadata(socket: &UdpSocket, remote: SocketAddr) -> io::Result<()> {
|
||||
linux::configure_receive_metadata(socket, remote)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::net::UdpSocket;
|
||||
|
||||
Reference in new issue
Block a user