mirror of
https://github.com/n0-computer/noq.git
synced 2026-09-19 09:45:20 +00:00
refactor(quinn-udp): make decode_recv generic over MsgHdr
Replace conditional compilation on the `hdr` parameter with a generic type bound `M: cmsg::MsgHdr<ControlMessage = libc::cmsghdr>`. This enables `decode_recv` to work with both `libc::msghdr` and `msghdr_x` message types. Broken out of #2463 as suggested by @djc.
This commit is contained in:
committed by
dignifiedquire
parent
0a6c94af8c
commit
d22db5291c
@@ -712,10 +712,9 @@ fn prepare_recv(
|
||||
hdr.msg_datalen = buf.len();
|
||||
}
|
||||
|
||||
fn decode_recv(
|
||||
fn decode_recv<M: cmsg::MsgHdr<ControlMessage = libc::cmsghdr>>(
|
||||
name: &MaybeUninit<libc::sockaddr_storage>,
|
||||
#[cfg(not(apple_fast))] hdr: &libc::msghdr,
|
||||
#[cfg(apple_fast)] hdr: &msghdr_x,
|
||||
hdr: &M,
|
||||
len: usize,
|
||||
) -> io::Result<RecvMeta> {
|
||||
let name = unsafe { name.assume_init() };
|
||||
|
||||
Reference in New Issue
Block a user