Skip to content

Commit

Permalink
Do not drop conn checker when updating tun without toggling multihop
Browse files Browse the repository at this point in the history
  • Loading branch information
dlon authored and Rawa committed Dec 17, 2024
1 parent a59360c commit 82ea7a3
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 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,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,
Expand All @@ -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,
Expand Down

0 comments on commit 82ea7a3

Please sign in to comment.