http load test: add keep_alive setting

This commit is contained in:
Joakim Frostegård 2022-04-10 01:01:34 +02:00
parent da6180e871
commit 7215d26ff4
2 changed files with 6 additions and 0 deletions

View file

@ -22,6 +22,7 @@ pub struct Config {
/// Announce/scrape url suffix. Use `/my_token/` to get `/announce/my_token/`
pub url_suffix: String,
pub duration: usize,
pub keep_alive: bool,
pub torrents: TorrentConfig,
pub cpu_pinning: CpuPinningConfigDesc,
}
@ -60,6 +61,7 @@ impl Default for Config {
connection_creation_interval_ms: 10,
url_suffix: "".into(),
duration: 0,
keep_alive: true,
torrents: TorrentConfig::default(),
cpu_pinning: Default::default(),
}

View file

@ -138,6 +138,10 @@ impl Connection {
loop {
self.send_request().await?;
self.read_response().await?;
if !self.config.keep_alive {
break Ok(());
}
}
}