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 0d386e3
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 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 @@ -126,7 +126,10 @@ impl WgGoTunnel {
connectivity_checker,
)
}
WgGoTunnel::Singlehop(state) if config.is_multihop() => {
WgGoTunnel::Singlehop(mut 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 0d386e3

Please sign in to comment.