diff --git a/TODO.md b/TODO.md index 96af016..0da1633 100644 --- a/TODO.md +++ b/TODO.md @@ -44,10 +44,8 @@ doesn't seem to be that expensive (1-2% cpu) ## aquatic_ws_load_test -* there are probably many failures when running against wt-tracker causing - removal of connections and for that reason bad performance. likely reason - is different peer_id on same connection -* why are so few answers received? +* still maybe too few answers received with aquatic_ws +* no offers received with wt-tracker. does it check that they are valid? ## aquatic_udp * handle errors similarily to aquatic_ws, including errors in socket workers diff --git a/aquatic_ws_load_test/src/network.rs b/aquatic_ws_load_test/src/network.rs index 47cc44f..438b5c7 100644 --- a/aquatic_ws_load_test/src/network.rs +++ b/aquatic_ws_load_test/src/network.rs @@ -176,6 +176,7 @@ impl Connection { config: &Config, state: &LoadTestState, rng: &mut impl Rng, + connection_id: usize ) -> bool { // bool = remove connection if !self.can_send { return false; @@ -185,7 +186,8 @@ impl Connection { let request = create_random_request( &config, &state, - rng + rng, + connection_id ); // If self.send_answer is set and request is announce request, make @@ -217,7 +219,7 @@ impl Connection { false } Err(err) => { - // eprintln!("send request error: {:?}", err); + eprintln!("send request error: {:?}", err); true } @@ -284,6 +286,7 @@ pub fn run_socket_thread( config, &state, &mut rng, + *k ); if drop_connection { diff --git a/aquatic_ws_load_test/src/utils.rs b/aquatic_ws_load_test/src/utils.rs index 096e6b4..f2af42f 100644 --- a/aquatic_ws_load_test/src/utils.rs +++ b/aquatic_ws_load_test/src/utils.rs @@ -12,6 +12,7 @@ pub fn create_random_request( config: &Config, state: &LoadTestState, rng: &mut impl Rng, + connection_id: usize, ) -> InMessage { let weights = [ config.torrents.weight_announce as u32, @@ -31,6 +32,7 @@ pub fn create_random_request( config, state, rng, + connection_id ), RequestType::Scrape => create_scrape_request( config, @@ -46,6 +48,7 @@ fn create_announce_request( config: &Config, state: &LoadTestState, rng: &mut impl Rng, + connection_id: usize ) -> InMessage { let (event, bytes_left) = { if rng.gen_bool(config.torrents.peer_seeder_probability) { @@ -66,9 +69,14 @@ 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 { info_hash: state.info_hashes[info_hash_index], - peer_id: PeerId(rng.gen()), + peer_id, bytes_left: Some(bytes_left), event, numwant: None,