Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support specififying non-default batch size #9

Merged
merged 1 commit into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,17 @@ mod imp;
pub use imp::{sync, UdpSocket};
pub mod framed;

/// Number of UDP packets to send/receive at a time
pub const BATCH_SIZE: usize = imp::BATCH_SIZE;
/// Maximum number of UDP packets that can be sent by the `sendmmsg`/`recvmmsg`
/// wrappers. Note that, for supported platforms, the OS caps the batch size at
/// this value, but will not return an error, so this is just a suggested
/// maximum.
///
/// Presently, this is 1024 on Linux an FreeBS, and 1 on platforms that don't
/// support `sendmmsg`/`recvmmsg`
pub const BATCH_SIZE_CAP: usize = imp::BATCH_SIZE_CAP;

/// Default number of UDP packets to send/receive at a time.
pub const DEFAULT_BATCH_SIZE: usize = imp::DEFAULT_BATCH_SIZE;

/// The capabilities a UDP socket suppports on a certain platform
#[derive(Debug)]
Expand Down
Loading
Loading