From 1f1d3f2ccfbe14c642fd18c64a540c7f7ddf6f29 Mon Sep 17 00:00:00 2001 From: Ferdinand Schober Date: Wed, 6 Nov 2024 23:38:16 +0100 Subject: [PATCH] properly terminate input capture --- src/capture.rs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/capture.rs b/src/capture.rs index d8aedfa9..cae5b1db 100644 --- a/src/capture.rs +++ b/src/capture.rs @@ -184,19 +184,18 @@ async fn do_capture( }); /* create barriers for active clients */ - if let Err(e) = create_clients(&mut capture, clients, request_rx).await { + let r = create_clients(&mut capture, clients, request_rx).await; + if let Err(e) = r { capture.terminate().await?; return Err(e.into()); } - if let Err(e) = - do_capture_session(active, &mut capture, conn, event_tx, request_rx, service).await - { - // FIXME replace with async drop when stabilized - capture.terminate().await?; - return Err(e); - } - Ok(()) + let r = do_capture_session(active, &mut capture, conn, event_tx, request_rx, service).await; + + // FIXME replace with async drop when stabilized + capture.terminate().await?; + + r } async fn create_clients(