diff options
| author | Emīls Piņķis <emils@mullvad.net> | 2018-09-10 18:23:36 +0100 |
|---|---|---|
| committer | Emīls Piņķis <emils@mullvad.net> | 2018-09-10 18:23:36 +0100 |
| commit | 2a109139fa7f7992a574055df75b2677661f3143 (patch) | |
| tree | ab12ed675b0818bcfb8b01d11684421c0dd70a70 | |
| parent | 01a1bfd53a3e3e0534ed78c841f4447be1afb763 (diff) | |
| parent | f2bc67d504b3755c895f90472ebe0f01b9f78c08 (diff) | |
| download | mullvadvpn-2a109139fa7f7992a574055df75b2677661f3143.tar.xz mullvadvpn-2a109139fa7f7992a574055df75b2677661f3143.zip | |
Merge branch 'fix-apply-target-state-when-blocked'
| -rw-r--r-- | mullvad-daemon/src/main.rs | 2 | ||||
| -rw-r--r-- | talpid-types/src/tunnel.rs | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/mullvad-daemon/src/main.rs b/mullvad-daemon/src/main.rs index b4b1f465a8..1bcdeb8dd2 100644 --- a/mullvad-daemon/src/main.rs +++ b/mullvad-daemon/src/main.rs @@ -593,7 +593,7 @@ impl Daemon { /// progress towards that state. /// Returns an error if trying to set secured state, but no account token is present. fn set_target_state(&mut self, new_state: TargetState) -> ::std::result::Result<(), ()> { - if new_state != self.target_state { + if new_state != self.target_state || self.tunnel_state.is_blocked() { debug!("Target state {:?} => {:?}", self.target_state, new_state); self.target_state = new_state; match self.target_state { diff --git a/talpid-types/src/tunnel.rs b/talpid-types/src/tunnel.rs index 1819919d5a..ab2b76ae96 100644 --- a/talpid-types/src/tunnel.rs +++ b/talpid-types/src/tunnel.rs @@ -17,6 +17,15 @@ pub enum TunnelStateTransition { Blocked(BlockReason), } +impl TunnelStateTransition { + pub fn is_blocked(&self) -> bool { + match self { + TunnelStateTransition::Blocked(_) => true, + _ => false, + } + } +} + /// Reason for entering the blocked state. #[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] |
