diff --git a/talpid-openvpn/src/lib.rs b/talpid-openvpn/src/lib.rs index 28578a2146db..2e3882fb37bf 100644 --- a/talpid-openvpn/src/lib.rs +++ b/talpid-openvpn/src/lib.rs @@ -169,7 +169,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. @@ -569,7 +569,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)); @@ -583,13 +583,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(); @@ -722,7 +722,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, }