diff --git a/quinn-udp/src/unix.rs b/quinn-udp/src/unix.rs index b59f0fdb37..b44bcfa072 100644 --- a/quinn-udp/src/unix.rs +++ b/quinn-udp/src/unix.rs @@ -43,6 +43,11 @@ pub struct UdpSocketState { } impl UdpSocketState { + /// Tokio-compatible UDP socket with some useful specializations + /// + /// # Panics + /// - If `CMSG_LEN` is too small to store a [`libc::in6_pktinfo`] and one `libc::c_int` (for ECN) + /// - If [`libc::cmsghdr`] has stricter alignment requirements than [`cmsg::Aligned`] pub fn new(sock: UdpSockRef<'_>) -> io::Result { let io = sock.0; let mut cmsg_platform_space = 0; diff --git a/quinn-udp/src/windows.rs b/quinn-udp/src/windows.rs index e29a177133..2970a9d187 100644 --- a/quinn-udp/src/windows.rs +++ b/quinn-udp/src/windows.rs @@ -25,6 +25,11 @@ pub struct UdpSocketState { } impl UdpSocketState { + /// Create a QUIC-friendly UDP socket for Windows + /// + /// # Panics + /// - If `CMSG_LEN` is too small to store a [`WinSock::IN6_PKTINFO`] and one `i32` (for ECN) + /// - If [`WinSock::CMSGHDR`] has stricter alignment requirements than [`cmsg::Aligned`] pub fn new(socket: UdpSockRef<'_>) -> io::Result { assert!( CMSG_LEN