aquatic ws load test: gen random PeerId per connection

Necessary for multiple workers
This commit is contained in:
Joakim Frostegård 2020-08-09 00:42:09 +02:00
parent 2d3761fee2
commit 0a23b62bd5
3 changed files with 9 additions and 21 deletions

View file

@ -12,7 +12,7 @@ pub fn create_random_request(
config: &Config,
state: &LoadTestState,
rng: &mut impl Rng,
connection_id: usize,
peer_id: PeerId
) -> InMessage {
let weights = [
config.torrents.weight_announce as u32,
@ -32,7 +32,7 @@ pub fn create_random_request(
config,
state,
rng,
connection_id
peer_id
),
RequestType::Scrape => create_scrape_request(
config,
@ -49,7 +49,7 @@ fn create_announce_request(
config: &Config,
state: &LoadTestState,
rng: &mut impl Rng,
connection_id: usize
peer_id: PeerId,
) -> InMessage {
let (event, bytes_left) = {
if rng.gen_bool(config.torrents.peer_seeder_probability) {
@ -74,11 +74,6 @@ fn create_announce_request(
})
}
let mut peer_id = PeerId([0u8; 20]);
(&mut peer_id.0[..8])
.copy_from_slice(&connection_id.to_ne_bytes());
InMessage::AnnounceRequest(AnnounceRequest {
action: AnnounceAction,
info_hash: state.info_hashes[info_hash_index],