diff --git a/talpid-openvpn/src/lib.rs b/talpid-openvpn/src/lib.rs index 7dc580a100e5..e6080044cb05 100644 --- a/talpid-openvpn/src/lib.rs +++ b/talpid-openvpn/src/lib.rs @@ -166,7 +166,7 @@ pub struct OpenVpnMonitor { >, abort_spawn: futures::future::AbortHandle, - child: Arc>>>, + child: Arc>>, proxy_monitor: Option>, closed: Arc, /// Keep the `TempFile` for the user-pass file in the struct, so it's removed on drop. @@ -566,7 +566,7 @@ impl OpenVpnMonitor { .await .expect("spawn task panicked") { - Ok(Ok(child)) => Arc::new(child), + Ok(Ok(child)) => child, Ok(Err(error)) => { self.closed.swap(true, Ordering::SeqCst); return WaitResult::Preparation(Err(error)); @@ -580,13 +580,13 @@ impl OpenVpnMonitor { } { - self.child.lock().await.replace(child.clone()); + self.child.lock().await.replace(child); } let event_server_abort_tx = self.event_server_abort_tx.clone(); let kill_child = async move { - let result = child.wait().await; + let result = self.child.lock().await.as_ref().unwrap().wait().await; let closed = self.closed.load(Ordering::SeqCst); let result = WaitResult::Child(result, closed); event_server_abort_tx.trigger(); @@ -719,7 +719,7 @@ impl OpenVpnMonitor { /// A handle to an `OpenVpnMonitor` for closing it. #[derive(Debug, Clone)] pub struct OpenVpnCloseHandle { - child: Arc>>>, + child: Arc>>, abort_spawn: futures::future::AbortHandle, closed: Arc, }