Skip to content

Commit

Permalink
Merge pull request #9 from shutton/variable-batch-size
Browse files Browse the repository at this point in the history
Support specififying non-default batch size
  • Loading branch information
leshow authored Aug 1, 2024
2 parents d059417 + faa071d commit 3d6d364
Show file tree
Hide file tree
Showing 2 changed files with 174 additions and 26 deletions.
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

0 comments on commit 3d6d364

Please sign in to comment.