diff options
| author | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2018-08-31 17:05:49 -0300 |
|---|---|---|
| committer | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2018-09-03 11:31:30 -0300 |
| commit | dfcc0a2e9b65eea6ed159261bfb88dfa4bdc1176 (patch) | |
| tree | d37a85adbb93c3a4b7e98e2c755d0816bf05ffb5 | |
| parent | 844fe7b9e71745608de3c318f2736d8df554a88f (diff) | |
| download | mullvadvpn-dfcc0a2e9b65eea6ed159261bfb88dfa4bdc1176.tar.xz mullvadvpn-dfcc0a2e9b65eea6ed159261bfb88dfa4bdc1176.zip | |
Don't trigger tunnel start when settings change
| -rw-r--r-- | mullvad-daemon/src/main.rs | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/mullvad-daemon/src/main.rs b/mullvad-daemon/src/main.rs index 9f8aa78729..4385b3a291 100644 --- a/mullvad-daemon/src/main.rs +++ b/mullvad-daemon/src/main.rs @@ -450,7 +450,7 @@ impl Daemon { self.set_target_state(TargetState::Unsecured)?; } else { info!("Initiating tunnel restart because the account token changed"); - self.connect_tunnel()?; + self.reconnect_tunnel()?; } } } @@ -499,7 +499,7 @@ impl Daemon { if changed { info!("Initiating tunnel restart because the relay settings changed"); - self.connect_tunnel()?; + self.reconnect_tunnel()?; } } Err(e) => error!("{}", e.display_chain()), @@ -575,7 +575,7 @@ impl Daemon { if settings_changed { info!("Initiating tunnel restart because the enable IPv6 setting changed"); - self.connect_tunnel()?; + self.reconnect_tunnel()?; } } Err(e) => error!("{}", e.display_chain()), @@ -652,6 +652,13 @@ impl Daemon { .expect("Tunnel state machine has stopped"); } + fn reconnect_tunnel(&mut self) -> Result<()> { + match self.target_state { + TargetState::Secured => self.connect_tunnel(), + TargetState::Unsecured => Ok(()), + } + } + fn build_tunnel_parameters(&mut self) -> Result<TunnelParameters> { let endpoint = match self.settings.get_relay_settings() { RelaySettings::CustomTunnelEndpoint(custom_relay) => custom_relay |
