Fix client stats: shared BandwidthState survives timeout cancellation
All checks were successful
CI / test (push) Successful in 1m24s

The state is now created in main.rs and passed into run_client, so
when --duration timeout cancels the future, the stats are still
accessible via shared_state.summary(). CSV and syslog now show
real speeds and byte counts.

Verified: TCP loopback shows 32 Gbps in CSV output.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Siavash Sameni
2026-04-01 10:05:50 +04:00
parent 5b07a079fe
commit d19ad25a3c
4 changed files with 31 additions and 16 deletions

View File

@@ -85,6 +85,7 @@ async fn test_ecsrp5_full_client_auth() {
Some("testuser".into()),
Some("testpass".into()),
false,
btest_rs::bandwidth::BandwidthState::new(),
)
.await
});
@@ -109,6 +110,7 @@ async fn test_ecsrp5_wrong_password_fails() {
Some("testuser".into()),
Some("wrongpass".into()),
false,
btest_rs::bandwidth::BandwidthState::new(),
)
.await;
@@ -131,6 +133,7 @@ async fn test_md5_auth_still_works() {
Some("testuser".into()),
Some("testpass".into()),
false,
btest_rs::bandwidth::BandwidthState::new(),
)
.await
});
@@ -155,6 +158,7 @@ async fn test_noauth_still_works() {
None,
None,
false,
btest_rs::bandwidth::BandwidthState::new(),
)
.await
});
@@ -179,6 +183,7 @@ async fn test_ecsrp5_udp_bidirectional() {
Some("testuser".into()),
Some("testpass".into()),
false,
btest_rs::bandwidth::BandwidthState::new(),
)
.await
});

View File

@@ -153,6 +153,7 @@ async fn test_loopback_tcp_rx() {
None,
None,
false,
btest_rs::bandwidth::BandwidthState::new(),
)
.await
});
@@ -177,6 +178,7 @@ async fn test_loopback_tcp_tx() {
None,
None,
false,
btest_rs::bandwidth::BandwidthState::new(),
)
.await
});
@@ -201,6 +203,7 @@ async fn test_loopback_tcp_both() {
None,
None,
false,
btest_rs::bandwidth::BandwidthState::new(),
)
.await
});
@@ -225,6 +228,7 @@ async fn test_loopback_tcp_with_auth() {
Some("admin".into()),
Some("secret".into()),
false,
btest_rs::bandwidth::BandwidthState::new(),
)
.await
});