diff --git a/crates/ws_load_test/src/common.rs b/crates/ws_load_test/src/common.rs index ceecacb..1e8266d 100644 --- a/crates/ws_load_test/src/common.rs +++ b/crates/ws_load_test/src/common.rs @@ -18,7 +18,7 @@ pub struct Statistics { #[derive(Clone)] pub struct LoadTestState { - pub info_hashes: Arc>, + pub info_hashes: Arc<[InfoHash]>, pub statistics: Arc, pub gamma: Arc>, } diff --git a/crates/ws_load_test/src/main.rs b/crates/ws_load_test/src/main.rs index 479f2aa..8be81cc 100644 --- a/crates/ws_load_test/src/main.rs +++ b/crates/ws_load_test/src/main.rs @@ -36,10 +36,10 @@ fn run(config: Config) -> ::anyhow::Result<()> { 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 info_hashes = Vec::with_capacity(config.torrents.number_of_torrents); + for _ in 0..config.torrents.number_of_torrents { info_hashes.push(InfoHash(rng.gen())); } @@ -51,7 +51,7 @@ fn run(config: Config) -> ::anyhow::Result<()> { .unwrap(); let state = LoadTestState { - info_hashes: Arc::new(info_hashes), + info_hashes: Arc::from(info_hashes.into_boxed_slice()), statistics: Arc::new(Statistics::default()), gamma: Arc::new(gamma), };