mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-04-01 18:25:30 +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 timeout = Duration::from_millis(50);
|
||||||
|
|
||||||
|
let cleaning_duration = Duration::from_secs(config.cleaning.connection_cleaning_interval);
|
||||||
|
|
||||||
let mut iter_counter = 0usize;
|
let mut iter_counter = 0usize;
|
||||||
let mut last_cleaning = Instant::now();
|
let mut last_cleaning = Instant::now();
|
||||||
|
|
||||||
|
|
@ -88,9 +90,7 @@ pub fn run_socket_worker(
|
||||||
if iter_counter % 32 == 0 {
|
if iter_counter % 32 == 0 {
|
||||||
let now = Instant::now();
|
let now = Instant::now();
|
||||||
|
|
||||||
if last_cleaning + Duration::from_secs(config.cleaning.connection_cleaning_interval)
|
if now > last_cleaning + cleaning_duration {
|
||||||
> now
|
|
||||||
{
|
|
||||||
connections.clean();
|
connections.clean();
|
||||||
|
|
||||||
last_cleaning = now;
|
last_cleaning = now;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue