refactor: return error when failed to connect

This commit is contained in:
Kevin Yue 2023-09-02 08:19:08 +08:00
parent 2136c3aa25
commit 9b9ac7fc8a

View File

@ -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) {