v0.2.1-pre.002-fix.001

This commit is contained in:
2026-08-17 18:46:52 +02:00
parent 0cff0406ab
commit d3fc0c6d69
8 changed files with 209 additions and 33 deletions

View File

@@ -1,5 +1,5 @@
// file: crates/ksp-onchain-transport-lib/src/settings.rs
// version: 1
// version: 2
/// Runtime HTTP endpoint URL owned by Transport.
///
@@ -475,13 +475,13 @@ fn validate_endpoint(endpoint: &crate::HttpEndpointSettings, endpoint_index: usi
if endpoint.request_timeout().is_zero() {
return invalid_settings("HTTP request timeout must be greater than zero", format!("endpoints[{endpoint_index}].request_timeout").as_str());
}
if let std::option::Option::Some(max_idle) = endpoint.max_idle_connections_per_host() {
if max_idle == 0 {
return invalid_settings(
"max idle connections per host must be greater than zero when configured",
format!("endpoints[{endpoint_index}].max_idle_connections_per_host").as_str(),
);
}
if let std::option::Option::Some(max_idle) = endpoint.max_idle_connections_per_host()
&& max_idle == 0
{
return invalid_settings(
"max idle connections per host must be greater than zero when configured",
format!("endpoints[{endpoint_index}].max_idle_connections_per_host").as_str(),
);
}
if endpoint.roles().is_empty() {
return invalid_settings("HTTP endpoint must declare at least one role", format!("endpoints[{endpoint_index}].roles").as_str());
@@ -548,13 +548,13 @@ fn validate_role(role: &crate::HttpEndpointRoleSettings, endpoint_index: usize,
format!("endpoints[{endpoint_index}].roles[{role_index}].limits.burst_capacity").as_str(),
);
}
if let std::option::Option::Some(pause) = role.limits().pause_after_rate_limit() {
if pause.is_zero() {
return invalid_settings(
"rate-limit cooldown must be greater than zero when configured",
format!("endpoints[{endpoint_index}].roles[{role_index}].limits.pause_after_rate_limit").as_str(),
);
}
if let std::option::Option::Some(pause) = role.limits().pause_after_rate_limit()
&& pause.is_zero()
{
return invalid_settings(
"rate-limit cooldown must be greater than zero when configured",
format!("endpoints[{endpoint_index}].roles[{role_index}].limits.pause_after_rate_limit").as_str(),
);
}
return std::result::Result::Ok(());
}