aquatic http load test: add option for closing conn after response

This commit is contained in:
Joakim Frostegård 2020-08-02 18:10:19 +02:00
parent f9d85117b1
commit 8a3f3fa330
2 changed files with 8 additions and 2 deletions

View file

@ -48,6 +48,7 @@ impl Connection {
pub fn read_response(
&mut self,
config: &Config,
state: &LoadTestState,
) -> bool { // bool = remove connection
loop {
@ -93,7 +94,7 @@ impl Connection {
self.bytes_read = 0;
self.can_send = true;
break false;
break config.network.close_connection_after_response;
},
Err(err) => {
eprintln!(
@ -218,7 +219,10 @@ pub fn run_socket_thread(
let token = event.token();
if let Some(connection) = connections.get_mut(&token.0){
let remove_connection = connection.read_response(&state);
let remove_connection = connection.read_response(
config,
&state
);
if remove_connection {
connections.remove(&token.0);