diff --git a/aquatic_http/src/workers/socket.rs b/aquatic_http/src/workers/socket.rs index 8c8b512..56e91bd 100644 --- a/aquatic_http/src/workers/socket.rs +++ b/aquatic_http/src/workers/socket.rs @@ -73,7 +73,6 @@ pub async fn run_socket_worker( let connection_slab = Rc::new(RefCell::new(Slab::new())); - // Periodically remove closed connections TimerActionRepeat::repeat(enclose!((config, connection_slab) move || { clean_connections( config.clone(), @@ -139,15 +138,15 @@ async fn clean_connections( let now = Instant::now(); connection_slab.borrow_mut().retain(|_, reference| { - let keep = reference.valid_until.0 > now; - - if !keep { + if reference.valid_until.0 > now { + true + } else { if let Some(ref handle) = reference.task_handle { handle.cancel(); } - } - keep + false + } }); connection_slab.borrow_mut().shrink_to_fit();