mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-03-31 17:55:36 +00:00
aquatic_ws_load_test: for single connection, use same PeerId
This commit is contained in:
parent
7733ee98ca
commit
e916780438
3 changed files with 16 additions and 7 deletions
6
TODO.md
6
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
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue