diff --git a/crates/irtt-client/src/client.rs b/crates/irtt-client/src/client.rs index 7e69ffc..e5d2e5c 100644 --- a/crates/irtt-client/src/client.rs +++ b/crates/irtt-client/src/client.rs @@ -40,6 +40,16 @@ pub struct Client { impl Client { pub fn connect(config: ClientConfig) -> Result { validate_open_timeouts(&config.open_timeouts)?; + if config.max_pending_probes == 0 { + return Err(ClientError::InvalidConfig { + reason: "max_pending_probes must be greater than zero".to_owned(), + }); + } + if config.probe_timeout == Duration::ZERO { + return Err(ClientError::InvalidConfig { + reason: "probe_timeout must be greater than zero".to_owned(), + }); + } let remote = resolve_remote(&config)?; let socket = connect_udp_socket(&config.socket_config, remote)?; let requested = params_from_config(&config)?; diff --git a/crates/irtt-client/src/error.rs b/crates/irtt-client/src/error.rs index d5faf76..a9da4a8 100644 --- a/crates/irtt-client/src/error.rs +++ b/crates/irtt-client/src/error.rs @@ -43,4 +43,6 @@ pub enum ClientError { DurationOverflow, #[error("pending probe limit exceeded ({limit})")] PendingLimitExceeded { limit: usize }, + #[error("invalid configuration: {reason}")] + InvalidConfig { reason: String }, }