mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-03-31 17:55:36 +00:00
ws: rewrite connection cleaning retain fn
This commit is contained in:
parent
775607da3c
commit
f0a1b8e1e1
1 changed files with 5 additions and 5 deletions
|
|
@ -156,15 +156,15 @@ async fn clean_connections(
|
||||||
let now = Instant::now();
|
let now = Instant::now();
|
||||||
|
|
||||||
connection_slab.borrow_mut().retain(|_, reference| {
|
connection_slab.borrow_mut().retain(|_, reference| {
|
||||||
let keep = reference.valid_until.0 > now;
|
if reference.valid_until.0 > now {
|
||||||
|
true
|
||||||
if !keep {
|
} else {
|
||||||
if let Some(ref handle) = reference.task_handle {
|
if let Some(ref handle) = reference.task_handle {
|
||||||
handle.cancel();
|
handle.cancel();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
keep
|
false
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
connection_slab.borrow_mut().shrink_to_fit();
|
connection_slab.borrow_mut().shrink_to_fit();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue