Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not drop connection checker when switching between single-hop and multi-hop tuns #7353

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading