From b9e875ad90dba11787f415285c2b3084a87357c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Frosteg=C3=A5rd?= Date: Mon, 20 Jul 2020 16:16:06 +0200 Subject: [PATCH] aquatic_http_load_test: slowly open a number of connections --- aquatic_http_load_test/src/network.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/aquatic_http_load_test/src/network.rs b/aquatic_http_load_test/src/network.rs index c889b16..79f5ff6 100644 --- a/aquatic_http_load_test/src/network.rs +++ b/aquatic_http_load_test/src/network.rs @@ -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); } }