mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-03-31 17:55:36 +00:00
ws load test: store global info hashes as Arc<[InfoHash]>
This commit is contained in:
parent
34167371b0
commit
27ecccd984
2 changed files with 4 additions and 4 deletions
|
|
@ -18,7 +18,7 @@ pub struct Statistics {
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct LoadTestState {
|
pub struct LoadTestState {
|
||||||
pub info_hashes: Arc<Vec<InfoHash>>,
|
pub info_hashes: Arc<[InfoHash]>,
|
||||||
pub statistics: Arc<Statistics>,
|
pub statistics: Arc<Statistics>,
|
||||||
pub gamma: Arc<Gamma<f64>>,
|
pub gamma: Arc<Gamma<f64>>,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,10 +36,10 @@ fn run(config: Config) -> ::anyhow::Result<()> {
|
||||||
|
|
||||||
println!("Starting client with config: {:#?}", config);
|
println!("Starting client with config: {:#?}", config);
|
||||||
|
|
||||||
let mut info_hashes = Vec::with_capacity(config.torrents.number_of_torrents);
|
|
||||||
|
|
||||||
let mut rng = SmallRng::from_entropy();
|
let mut rng = SmallRng::from_entropy();
|
||||||
|
|
||||||
|
let mut info_hashes = Vec::with_capacity(config.torrents.number_of_torrents);
|
||||||
|
|
||||||
for _ in 0..config.torrents.number_of_torrents {
|
for _ in 0..config.torrents.number_of_torrents {
|
||||||
info_hashes.push(InfoHash(rng.gen()));
|
info_hashes.push(InfoHash(rng.gen()));
|
||||||
}
|
}
|
||||||
|
|
@ -51,7 +51,7 @@ fn run(config: Config) -> ::anyhow::Result<()> {
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let state = LoadTestState {
|
let state = LoadTestState {
|
||||||
info_hashes: Arc::new(info_hashes),
|
info_hashes: Arc::from(info_hashes.into_boxed_slice()),
|
||||||
statistics: Arc::new(Statistics::default()),
|
statistics: Arc::new(Statistics::default()),
|
||||||
gamma: Arc::new(gamma),
|
gamma: Arc::new(gamma),
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue