summaryrefslogtreecommitdiffhomepage
path: root/talpid-core/src
diff options
context:
space:
mode:
authorDavid Lönnhager <david.l@mullvad.net>2024-01-29 13:19:42 +0100
committerDavid Lönnhager <david.l@mullvad.net>2024-01-31 11:02:49 +0100
commit19e28d9e1c0dd0b160c6083db61760d07ee00432 (patch)
treedec8e01d682fd9a5acc1fecf8d8223257fcdd2f5 /talpid-core/src
parentc09307718470851d0f2ec1a3194f2e7a699e2248 (diff)
downloadmullvadvpn-19e28d9e1c0dd0b160c6083db61760d07ee00432.tar.xz
mullvadvpn-19e28d9e1c0dd0b160c6083db61760d07ee00432.zip
Coalesce tunnel device errors on Windows
Diffstat (limited to 'talpid-core/src')
-rw-r--r--talpid-core/src/tunnel_state_machine/connecting_state.rs14
1 files changed, 5 insertions, 9 deletions
diff --git a/talpid-core/src/tunnel_state_machine/connecting_state.rs b/talpid-core/src/tunnel_state_machine/connecting_state.rs
index 75f3d8eebf..ec8ddc5f2c 100644
--- a/talpid-core/src/tunnel_state_machine/connecting_state.rs
+++ b/talpid-core/src/tunnel_state_machine/connecting_state.rs
@@ -37,7 +37,7 @@ pub(crate) type TunnelCloseEvent = Fuse<oneshot::Receiver<Option<ErrorStateCause
const MAX_ATTEMPTS_WITH_SAME_TUN: u32 = 5;
const MIN_TUNNEL_ALIVE_TIME: Duration = Duration::from_millis(1000);
#[cfg(target_os = "windows")]
-const MAX_RECOVERABLE_FAIL_RETRIES: u32 = 4;
+const MAX_ATTEMPT_CREATE_TUN: u32 = 4;
const INITIAL_ALLOWED_TUNNEL_TRAFFIC: AllowedTunnelTraffic = AllowedTunnelTraffic::None;
@@ -589,7 +589,6 @@ fn should_retry(error: &tunnel::Error, retry_attempt: u32) -> bool {
tunnel::Error::WireguardTunnelMonitoringError(Error::PskNegotiationError(_)) => true,
- #[cfg(not(windows))]
tunnel::Error::WireguardTunnelMonitoringError(Error::TunnelError(
TunnelError::RecoverableStartWireguardError,
)) => true,
@@ -606,14 +605,11 @@ fn should_retry(error: &tunnel::Error, retry_attempt: u32) -> bool {
#[cfg(windows)]
tunnel::Error::WireguardTunnelMonitoringError(Error::TunnelError(
- // This usually occurs when the tunnel interface cannot be created.
- TunnelError::RecoverableStartWireguardError,
- )) if retry_attempt < MAX_RECOVERABLE_FAIL_RETRIES => true,
-
- #[cfg(windows)]
- tunnel::Error::OpenVpnTunnelMonitoringError(
+ TunnelError::SetupTunnelDevice(_),
+ ))
+ | tunnel::Error::OpenVpnTunnelMonitoringError(
talpid_openvpn::Error::WintunCreateAdapterError(_),
- ) if retry_attempt < MAX_RECOVERABLE_FAIL_RETRIES => true,
+ ) if retry_attempt < MAX_ATTEMPT_CREATE_TUN => true,
_ => false,
}