aquatic_http_load_test: slowly open a number of connections

This commit is contained in:
Joakim Frostegård 2020-07-20 16:16:06 +02:00
parent 8d41d98fec
commit b9e875ad90

View file

@ -170,6 +170,9 @@ pub fn run_socket_thread(
}
let mut initial_sent = false;
let mut iter_counter = 0usize;
const CREATE_CONN_INTERVAL: usize = 2 ^ 20;
loop {
poll.poll(&mut events, Some(timeout))
@ -201,13 +204,18 @@ pub fn run_socket_thread(
}
}
if token_counter < 1 { // Only create one connection at the moment
// Slowly create new connections
if token_counter < 128 && iter_counter % CREATE_CONN_INTERVAL == 0 {
Connection::create_and_register(
config,
&mut connections,
&mut poll,
&mut token_counter,
).unwrap();
initial_sent = false;
}
iter_counter = iter_counter.wrapping_add(1);
}
}