diff --git a/crates/udp_load_test/src/common.rs b/crates/udp_load_test/src/common.rs index 6f40729..ade23ac 100644 --- a/crates/udp_load_test/src/common.rs +++ b/crates/udp_load_test/src/common.rs @@ -27,7 +27,7 @@ pub struct Statistics { #[derive(Clone)] pub struct LoadTestState { - pub info_hashes: Arc>, + pub info_hashes: Arc<[InfoHash]>, pub statistics: Arc, } diff --git a/crates/udp_load_test/src/lib.rs b/crates/udp_load_test/src/lib.rs index d040c41..0ce9a51 100644 --- a/crates/udp_load_test/src/lib.rs +++ b/crates/udp_load_test/src/lib.rs @@ -46,7 +46,7 @@ pub fn run(config: Config) -> ::anyhow::Result<()> { } let state = LoadTestState { - info_hashes: Arc::new(info_hashes), + info_hashes: Arc::from(info_hashes.into_boxed_slice()), statistics: Arc::new(Statistics::default()), }; diff --git a/crates/udp_load_test/src/worker/request_gen.rs b/crates/udp_load_test/src/worker/request_gen.rs index 60a6798..1f311f3 100644 --- a/crates/udp_load_test/src/worker/request_gen.rs +++ b/crates/udp_load_test/src/worker/request_gen.rs @@ -13,7 +13,7 @@ use crate::utils::*; pub fn process_response( rng: &mut impl Rng, gamma: Gamma, - info_hashes: &Arc>, + info_hashes: &Arc<[InfoHash]>, config: &Config, torrent_peers: &mut TorrentPeerMap, response: Response, @@ -89,7 +89,7 @@ pub fn process_response( fn if_torrent_peer_move_and_create_random_request( config: &Config, rng: &mut impl Rng, - info_hashes: &Arc>, + info_hashes: &Arc<[InfoHash]>, torrent_peers: &mut TorrentPeerMap, transaction_id: TransactionId, ) -> Option { @@ -110,7 +110,7 @@ fn if_torrent_peer_move_and_create_random_request( fn create_random_request( config: &Config, rng: &mut impl Rng, - info_hashes: &Arc>, + info_hashes: &Arc<[InfoHash]>, transaction_id: TransactionId, torrent_peer: &TorrentPeer, ) -> Request { @@ -168,7 +168,7 @@ fn create_announce_request( } fn create_scrape_request( - info_hashes: &Arc>, + info_hashes: &Arc<[InfoHash]>, torrent_peer: &TorrentPeer, transaction_id: TransactionId, ) -> Request { @@ -192,7 +192,7 @@ fn create_torrent_peer( config: &Config, rng: &mut impl Rng, gamma: Gamma, - info_hashes: &Arc>, + info_hashes: &Arc<[InfoHash]>, connection_id: ConnectionId, ) -> TorrentPeer { let num_scape_hashes = rng.gen_range(1..config.requests.scrape_max_torrents);