Skip to content

Commit 048d10f

Browse files
committed
allow flows to be u32
1 parent a954228 commit 048d10f

3 files changed

Lines changed: 16 additions & 8 deletions

File tree

lading/src/blackhole/tcp_crr.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
//! `connections_closed`: Flow removals (client close + I/O errors)
2020
2121
use std::net::{IpAddr, SocketAddr};
22-
use std::num::{NonZeroU16, NonZeroUsize};
22+
use std::num::{NonZeroU16, NonZeroU32, NonZeroUsize};
2323

2424
use serde::{Deserialize, Serialize};
2525

@@ -30,6 +30,10 @@ fn default_nonzero_u16() -> NonZeroU16 {
3030
NonZeroU16::new(1).expect("1 is nonzero")
3131
}
3232

33+
fn default_nonzero_u32() -> NonZeroU32 {
34+
NonZeroU32::new(1).expect("1 is nonzero")
35+
}
36+
3337
fn default_nonzero_usize() -> NonZeroUsize {
3438
NonZeroUsize::new(1).expect("1 is nonzero")
3539
}
@@ -69,8 +73,8 @@ pub struct Config {
6973
/// Total number of TCP flows the generator should open (neper `-F`).
7074
/// Default 1. Sent to the generator over the control connection at
7175
/// startup; the generator does not configure this independently.
72-
#[serde(default = "default_nonzero_u16")]
73-
pub flows: NonZeroU16,
76+
#[serde(default = "default_nonzero_u32")]
77+
pub flows: NonZeroU32,
7478
/// Bytes to read per request. Default 1.
7579
#[serde(default = "default_nonzero_usize")]
7680
pub request_size: NonZeroUsize,

lading/src/blackhole/tcp_rr.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
//! `bytes_written`: Response bytes sent
1818
1919
use std::net::{IpAddr, SocketAddr};
20-
use std::num::{NonZeroU16, NonZeroUsize};
20+
use std::num::{NonZeroU16, NonZeroU32, NonZeroUsize};
2121

2222
use serde::{Deserialize, Serialize};
2323

@@ -28,6 +28,10 @@ fn default_nonzero_u16() -> NonZeroU16 {
2828
NonZeroU16::new(1).expect("1 is nonzero")
2929
}
3030

31+
fn default_nonzero_u32() -> NonZeroU32 {
32+
NonZeroU32::new(1).expect("1 is nonzero")
33+
}
34+
3135
fn default_nonzero_usize() -> NonZeroUsize {
3236
NonZeroUsize::new(1).expect("1 is nonzero")
3337
}
@@ -67,8 +71,8 @@ pub struct Config {
6771
/// Total number of TCP flows the generator should open.
6872
/// Default 1. Sent to the generator over the control connection at
6973
/// startup; the generator does not configure this independently.
70-
#[serde(default = "default_nonzero_u16")]
71-
pub flows: NonZeroU16,
74+
#[serde(default = "default_nonzero_u32")]
75+
pub flows: NonZeroU32,
7276
/// Bytes to read per request. Default 1.
7377
#[serde(default = "default_nonzero_usize")]
7478
pub request_size: NonZeroUsize,

lading/src/neper/rr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ pub(crate) struct ServerParams {
8686
pub(crate) threads: u16,
8787
/// Total number of TCP flows the client should open. Sent to the client
8888
/// over the control connection during startup.
89-
pub(crate) flows: u16,
89+
pub(crate) flows: u32,
9090
/// Bytes to read per request.
9191
pub(crate) request_size: usize,
9292
/// Bytes to send per response.
@@ -712,7 +712,7 @@ fn server_thread_main(
712712
binding_addr: SocketAddr,
713713
prebuilt_listener: Option<net::TcpListener>,
714714
backlog: i32,
715-
num_flows: u16,
715+
num_flows: u32,
716716
request_size: usize,
717717
response_size: usize,
718718
no_delay: bool,

0 commit comments

Comments
 (0)