mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-03-31 17:55:36 +00:00
aquatic_http_load_test: deregister socket before removing it
This commit is contained in:
parent
72183d7fc2
commit
4bffecc345
1 changed files with 22 additions and 4 deletions
|
|
@ -177,6 +177,9 @@ impl Connection {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn deregister(&mut self, poll: &mut Poll) -> ::std::io::Result<()> {
|
||||||
|
poll.registry().deregister(&mut self.stream)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -223,10 +226,11 @@ pub fn run_socket_thread(
|
||||||
let token = event.token();
|
let token = event.token();
|
||||||
|
|
||||||
if let Some(connection) = connections.get_mut(&token.0){
|
if let Some(connection) = connections.get_mut(&token.0){
|
||||||
let remove_connection = connection.read_response(&state);
|
// Note that this does not indicate successfully reading
|
||||||
|
// response
|
||||||
|
if connection.read_response(&state){
|
||||||
|
remove_connection(&mut poll, &mut connections, token.0);
|
||||||
|
|
||||||
if remove_connection {
|
|
||||||
connections.remove(&token.0);
|
|
||||||
num_to_create += 1;
|
num_to_create += 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -249,7 +253,8 @@ pub fn run_socket_thread(
|
||||||
}
|
}
|
||||||
|
|
||||||
for k in drop_connections.drain(..) {
|
for k in drop_connections.drain(..) {
|
||||||
connections.remove(&k);
|
remove_connection(&mut poll, &mut connections, k);
|
||||||
|
|
||||||
num_to_create += 1;
|
num_to_create += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -277,3 +282,16 @@ pub fn run_socket_thread(
|
||||||
iter_counter = iter_counter.wrapping_add(1);
|
iter_counter = iter_counter.wrapping_add(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fn remove_connection(
|
||||||
|
poll: &mut Poll,
|
||||||
|
connections: &mut ConnectionMap,
|
||||||
|
connection_id: usize,
|
||||||
|
){
|
||||||
|
if let Some(mut connection) = connections.remove(&connection_id){
|
||||||
|
if let Err(err) = connection.deregister(poll){
|
||||||
|
eprintln!("couldn't deregister connection: {}", err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue