mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-03-31 17:55:36 +00:00
aquatic_udp: mio: fix bug where connections were cleaned all the time
This commit is contained in:
parent
f86b8fb606
commit
f5b93fbd3e
1 changed files with 3 additions and 3 deletions
|
|
@ -52,6 +52,8 @@ pub fn run_socket_worker(
|
|||
|
||||
let timeout = Duration::from_millis(50);
|
||||
|
||||
let cleaning_duration = Duration::from_secs(config.cleaning.connection_cleaning_interval);
|
||||
|
||||
let mut iter_counter = 0usize;
|
||||
let mut last_cleaning = Instant::now();
|
||||
|
||||
|
|
@ -88,9 +90,7 @@ pub fn run_socket_worker(
|
|||
if iter_counter % 32 == 0 {
|
||||
let now = Instant::now();
|
||||
|
||||
if last_cleaning + Duration::from_secs(config.cleaning.connection_cleaning_interval)
|
||||
> now
|
||||
{
|
||||
if now > last_cleaning + cleaning_duration {
|
||||
connections.clean();
|
||||
|
||||
last_cleaning = now;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue