Skip to content

Commit 3d6d364

Browse files
authored
Merge pull request #9 from shutton/variable-batch-size
Support specififying non-default batch size
2 parents d059417 + faa071d commit 3d6d364

File tree

2 files changed

+174
-26
lines changed

2 files changed

+174
-26
lines changed

src/lib.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,17 @@ mod imp;
1616
pub use imp::{sync, UdpSocket};
1717
pub mod framed;
1818

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

2231
/// The capabilities a UDP socket suppports on a certain platform
2332
#[derive(Debug)]

0 commit comments

Comments
 (0)