diff options
| author | David Lönnhager <david.l@mullvad.net> | 2021-11-24 15:22:33 +0100 |
|---|---|---|
| committer | David Lönnhager <david.l@mullvad.net> | 2021-11-26 10:42:46 +0100 |
| commit | 239a54aff75e43e371090c66e0ce121e89a5d5fa (patch) | |
| tree | 6d0b794110efea22a37797a482ae75c0b0369a2d | |
| parent | dfadebf2c86474b4ae33bce37bfcd934a0bcce1f (diff) | |
| download | mullvadvpn-239a54aff75e43e371090c66e0ce121e89a5d5fa.tar.xz mullvadvpn-239a54aff75e43e371090c66e0ce121e89a5d5fa.zip | |
Remove exposed runtime handle from the Unix route manager
| -rw-r--r-- | talpid-core/src/routing/unix.rs | 6 | ||||
| -rw-r--r-- | talpid-core/src/tunnel/wireguard/mod.rs | 18 |
2 files changed, 11 insertions, 13 deletions
diff --git a/talpid-core/src/routing/unix.rs b/talpid-core/src/routing/unix.rs index 2631acbc89..aa1cf66f6b 100644 --- a/talpid-core/src/routing/unix.rs +++ b/talpid-core/src/routing/unix.rs @@ -256,12 +256,6 @@ impl RouteManager { Err(Error::RouteManagerDown) } } - - /// Exposes runtime handle - #[cfg(target_os = "linux")] - pub fn runtime_handle(&self) -> tokio::runtime::Handle { - self.runtime.clone() - } } impl Drop for RouteManager { diff --git a/talpid-core/src/tunnel/wireguard/mod.rs b/talpid-core/src/tunnel/wireguard/mod.rs index a3fa426ca2..e2889166a7 100644 --- a/talpid-core/src/tunnel/wireguard/mod.rs +++ b/talpid-core/src/tunnel/wireguard/mod.rs @@ -184,8 +184,14 @@ impl WireguardMonitor { } } - let tunnel = - Self::open_tunnel(&config, log_path, resource_dir, tun_provider, route_manager)?; + let tunnel = Self::open_tunnel( + runtime.clone(), + &config, + log_path, + resource_dir, + tun_provider, + route_manager, + )?; let iface_name = tunnel.get_interface_name().to_string(); #[cfg(windows)] let iface_luid = tunnel.get_interface_luid(); @@ -310,6 +316,7 @@ impl WireguardMonitor { #[allow(unused_variables)] fn open_tunnel( + runtime: tokio::runtime::Handle, config: &Config, log_path: Option<&Path>, resource_dir: &Path, @@ -319,10 +326,7 @@ impl WireguardMonitor { #[cfg(target_os = "linux")] if !*FORCE_USERSPACE_WIREGUARD { if crate::dns::will_use_nm() { - match wireguard_kernel::NetworkManagerTunnel::new( - route_manager.runtime_handle(), - config, - ) { + match wireguard_kernel::NetworkManagerTunnel::new(runtime, config) { Ok(tunnel) => { log::debug!("Using NetworkManager to use kernel WireGuard implementation"); return Ok(Box::new(tunnel)); @@ -337,7 +341,7 @@ impl WireguardMonitor { } }; } else { - match wireguard_kernel::NetlinkTunnel::new(route_manager.runtime_handle(), config) { + match wireguard_kernel::NetlinkTunnel::new(runtime, config) { Ok(tunnel) => { log::debug!("Using kernel WireGuard implementation"); return Ok(Box::new(tunnel)); |
