udp_socket/
lib.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#[cfg(unix)]
mod cmsg;
mod proto;
mod socket;
#[cfg(unix)]
mod unix;

pub use proto::{EcnCodepoint, RecvMeta, SocketType, Transmit, UdpCapabilities};
pub use socket::UdpSocket;

/// Number of UDP packets to send/receive at a time when using sendmmsg/recvmmsg.
pub const BATCH_SIZE: usize = {
    if cfg!(target_os = "linux") {
        // Chosen somewhat arbitrarily; might benefit from additional tuning.
        32
    } else {
        1
    }
};