Make connection addition and deletion in order

This commit is contained in:
Ruihan Li
2025-03-18 20:03:28 +08:00
committed by Tate, Hongliang Tian
parent a7e718e812
commit 240192f735
3 changed files with 94 additions and 72 deletions

View File

@ -286,14 +286,13 @@ impl<E: Ext> SocketTable<E> {
&mut self.connection_buckets[bucket_index as usize]
};
if let Some(index) = bucket
let index = bucket
.connections
.iter()
.position(|tcp_connection| tcp_connection.connection_key() == key)
{
let connection = bucket.connections.swap_remove(index);
connection.on_dead_events();
}
.unwrap();
let connection = bucket.connections.swap_remove(index);
connection.on_dead_events();
}
pub(crate) fn remove_udp_socket(