diff options
| author | David Lönnhager <david.l@mullvad.net> | 2024-12-17 10:05:08 +0100 |
|---|---|---|
| committer | David Göransson <david.goransson@mullvad.net> | 2024-12-17 16:49:35 +0100 |
| commit | 9f474cb71ecfa77f9ca30890e84263ecf5b8a2ea (patch) | |
| tree | c188e40017405bd49f58b305546f8cf323ec9fbe /talpid-wireguard | |
| parent | 40affe209ef01c47cb477625198cc5261643b5fb (diff) | |
| download | mullvadvpn-9f474cb71ecfa77f9ca30890e84263ecf5b8a2ea.tar.xz mullvadvpn-9f474cb71ecfa77f9ca30890e84263ecf5b8a2ea.zip | |
Do not drop conn checker when updating tun without toggling multihop
Diffstat (limited to 'talpid-wireguard')
| -rw-r--r-- | talpid-wireguard/src/wireguard_go/mod.rs | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/talpid-wireguard/src/wireguard_go/mod.rs b/talpid-wireguard/src/wireguard_go/mod.rs index 39b23a185a..b91f3c464a 100644 --- a/talpid-wireguard/src/wireguard_go/mod.rs +++ b/talpid-wireguard/src/wireguard_go/mod.rs @@ -106,17 +106,18 @@ impl WgGoTunnel { } } - pub fn set_config(mut self, config: &Config) -> Result<Self> { - let connectivity_checker = self - .take_checker() - .expect("connectivity checker unexpectedly dropped"); + pub fn set_config(self, config: &Config) -> Result<Self> { let state = self.as_state(); let log_path = state._logging_context.path.clone(); let tun_provider = Arc::clone(&state.tun_provider); let routes = config.get_tunnel_destinations(); match self { - WgGoTunnel::Multihop(state) if !config.is_multihop() => { + WgGoTunnel::Multihop(mut state) if !config.is_multihop() => { + let connectivity_checker = state + .connectivity_checker + .take() + .expect("connectivity checker unexpectedly dropped"); state.stop()?; Self::start_tunnel( config, @@ -126,7 +127,11 @@ impl WgGoTunnel { connectivity_checker, ) } - WgGoTunnel::Singlehop(state) if config.is_multihop() => { + WgGoTunnel::Singlehop(mut state) if config.is_multihop() => { + let connectivity_checker = state + .connectivity_checker + .take() + .expect("connectivity checker unexpectedly dropped"); state.stop()?; Self::start_multihop_tunnel( config, |
