summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLinus Färnstrand <linus@mullvad.net>2019-10-29 10:46:45 +0100
committerLinus Färnstrand <linus@mullvad.net>2019-10-29 10:50:30 +0100
commit097876fed792397e77108ec11dfc68ce9ed35d44 (patch)
tree7b0277b1749cd63f8e6ac59c30d62a3486aca0a2
parent9a33040939cfb76f77a80392dc56604521362e56 (diff)
downloadmullvadvpn-097876fed792397e77108ec11dfc68ce9ed35d44.tar.xz
mullvadvpn-097876fed792397e77108ec11dfc68ce9ed35d44.zip
Use less `return` keywords around waiting for OpenVPN
-rw-r--r--talpid-core/src/tunnel/openvpn.rs17
1 files changed, 7 insertions, 10 deletions
diff --git a/talpid-core/src/tunnel/openvpn.rs b/talpid-core/src/tunnel/openvpn.rs
index 59d2d0f759..1f494cbe88 100644
--- a/talpid-core/src/tunnel/openvpn.rs
+++ b/talpid-core/src/tunnel/openvpn.rs
@@ -281,27 +281,24 @@ impl<C: OpenVpnBuilder + 'static> OpenVpnMonitor<C> {
let _ = rx.recv();
match result {
- Stopped::Tunnel(tunnel_result) => {
- return tunnel_result;
- }
+ Stopped::Tunnel(tunnel_result) => tunnel_result,
Stopped::Proxy(proxy_result) => {
// The proxy should never exit before openvpn.
match proxy_result {
Ok(proxy::WaitResult::ProperShutdown) => {
- return Err(Error::ProxyExited("No details".to_owned()));
+ Err(Error::ProxyExited("No details".to_owned()))
}
Ok(proxy::WaitResult::UnexpectedExit(details)) => {
- return Err(Error::ProxyExited(details));
- }
- Err(err) => {
- return Err(err).map_err(Error::MonitorProxyError);
+ Err(Error::ProxyExited(details))
}
+ Err(err) => Err(err).map_err(Error::MonitorProxyError),
}
}
}
+ } else {
+ // No proxy active, wait only for the tunnel.
+ self.wait_tunnel()
}
- // No proxy active, wait only for the tunnel.
- self.wait_tunnel()
}
/// Supplement `inner_wait_tunnel()` with logging and error handling.