mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-03-31 09:45:31 +00:00
udp load test: use connection IDs from responses in requests
This commit is contained in:
parent
efa79303d2
commit
0b6a02e1a7
2 changed files with 15 additions and 2 deletions
|
|
@ -124,7 +124,7 @@ impl Default for RequestConfig {
|
|||
number_of_peers: 2_000_000,
|
||||
scrape_max_torrents: 10,
|
||||
announce_peers_wanted: 30,
|
||||
weight_connect: 0,
|
||||
weight_connect: 1,
|
||||
weight_announce: 100,
|
||||
weight_scrape: 1,
|
||||
peer_seeder_probability: 0.75,
|
||||
|
|
|
|||
|
|
@ -89,7 +89,10 @@ impl Worker {
|
|||
for _ in 0..self.sockets.len() {
|
||||
match self.request_type_dist.sample(&mut self.rng) {
|
||||
RequestType::Connect => {
|
||||
self.send_connect_request(connect_socket_index, u32::MAX - 1);
|
||||
self.send_connect_request(
|
||||
connect_socket_index,
|
||||
connect_socket_index.into(),
|
||||
);
|
||||
|
||||
connect_socket_index = connect_socket_index.wrapping_add(1)
|
||||
% self.config.network.sockets_per_worker;
|
||||
|
|
@ -117,6 +120,16 @@ impl Worker {
|
|||
match socket.recv(&mut self.buffer[..]) {
|
||||
Ok(amt) => {
|
||||
match Response::parse_bytes(&self.buffer[0..amt], self.addr.is_ipv4()) {
|
||||
Ok(Response::Connect(r)) => {
|
||||
// If we're sending connect requests, we might
|
||||
// as well keep connection IDs valid
|
||||
let connection_id_index =
|
||||
u32::from_ne_bytes(r.transaction_id.0.get().to_ne_bytes())
|
||||
as usize;
|
||||
connection_ids[connection_id_index] = r.connection_id;
|
||||
|
||||
self.handle_response(Response::Connect(r));
|
||||
}
|
||||
Ok(response) => {
|
||||
self.handle_response(response);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue