diff options
| -rw-r--r-- | mullvad-jni/src/vpn_service_tun_provider.rs | 4 | ||||
| -rw-r--r-- | talpid-core/src/tunnel/tun_provider/mod.rs | 4 | ||||
| -rw-r--r-- | talpid-core/src/tunnel/tun_provider/stub.rs | 5 |
3 files changed, 13 insertions, 0 deletions
diff --git a/mullvad-jni/src/vpn_service_tun_provider.rs b/mullvad-jni/src/vpn_service_tun_provider.rs index 854e5d95a4..afb9ca8970 100644 --- a/mullvad-jni/src/vpn_service_tun_provider.rs +++ b/mullvad-jni/src/vpn_service_tun_provider.rs @@ -159,6 +159,10 @@ impl TunProvider for VpnServiceTunProvider { object: self.object.clone(), })) } + + fn close_tun(&mut self) { + self.active_tun = None; + } } struct VpnServiceTun { diff --git a/talpid-core/src/tunnel/tun_provider/mod.rs b/talpid-core/src/tunnel/tun_provider/mod.rs index 8f22a43052..d11f245626 100644 --- a/talpid-core/src/tunnel/tun_provider/mod.rs +++ b/talpid-core/src/tunnel/tun_provider/mod.rs @@ -51,6 +51,10 @@ pub trait Tun: Send { pub trait TunProvider: Send + 'static { /// Retrieve a tunnel device with the provided configuration. fn get_tun(&mut self, config: TunConfig) -> Result<Box<dyn Tun>, BoxedError>; + + /// Close currently active tunnel device. + #[cfg(target_os = "android")] + fn close_tun(&mut self); } /// Configuration for creating a tunnel device. diff --git a/talpid-core/src/tunnel/tun_provider/stub.rs b/talpid-core/src/tunnel/tun_provider/stub.rs index 0d4f6b1704..055bb8156e 100644 --- a/talpid-core/src/tunnel/tun_provider/stub.rs +++ b/talpid-core/src/tunnel/tun_provider/stub.rs @@ -14,4 +14,9 @@ impl TunProvider for StubTunProvider { fn get_tun(&mut self, _: TunConfig) -> Result<Box<dyn Tun>, BoxedError> { unimplemented!(); } + + #[cfg(target_os = "android")] + fn close_tun(&mut self) { + unimplemented!(); + } } |
