Skip to content

Commit

Permalink
Do not drop connection checker when updating tun without enabling or
Browse files Browse the repository at this point in the history
disabling multihop
  • Loading branch information
dlon committed Dec 17, 2024
1 parent a59360c commit 0f2f1f8
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions talpid-wireguard/src/wireguard_go/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,17 +106,17 @@ 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 = self
.take_checker()
.expect("connectivity checker unexpectedly dropped");
state.stop()?;
Self::start_tunnel(
config,
Expand All @@ -127,6 +127,9 @@ impl WgGoTunnel {
)
}
WgGoTunnel::Singlehop(state) if config.is_multihop() => {
let connectivity_checker = self
.take_checker()
.expect("connectivity checker unexpectedly dropped");
state.stop()?;
Self::start_multihop_tunnel(
config,
Expand Down

0 comments on commit 0f2f1f8

Please sign in to comment.