From 9b9ac7fc8a65a32f0046d1784b921e90ce8cb3d4 Mon Sep 17 00:00:00 2001 From: Kevin Yue Date: Sat, 2 Sep 2023 08:19:08 +0800 Subject: [PATCH] refactor: return error when failed to connect --- gpcommon/src/vpn/mod.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gpcommon/src/vpn/mod.rs b/gpcommon/src/vpn/mod.rs index 4bd78ce..85122ea 100644 --- a/gpcommon/src/vpn/mod.rs +++ b/gpcommon/src/vpn/mod.rs @@ -103,16 +103,16 @@ impl Vpn { status_holder.blocking_lock().set(VpnStatus::Disconnected); }); - info!("Waiting for the VPN connection..."); + info!("Waiting for the VPN to connect..."); if let Some(cmd_pipe_fd) = vpn_rx.recv().await { info!("VPN connection started, cmd_pipe_fd: {}", cmd_pipe_fd); self.status_holder.lock().await.set(VpnStatus::Connected); + Ok(()) } else { warn!("VPN connection failed to start"); + Err("VPN connection failed to start".into()) } - - Ok(()) } pub async fn disconnect(&self) {