diff options
| author | David Lönnhager <david.l@mullvad.net> | 2024-11-21 07:55:47 +0100 |
|---|---|---|
| committer | David Lönnhager <david.l@mullvad.net> | 2024-11-21 14:16:09 +0100 |
| commit | b331dce20b0fb84d9e200bcff1748d60f4f84f75 (patch) | |
| tree | a72faff3d4d112da5b480d1be113c4a88304cd1a /talpid-core | |
| parent | f01e573906a7b24b18365340966bda362924b745 (diff) | |
| download | mullvadvpn-b331dce20b0fb84d9e200bcff1748d60f4f84f75.tar.xz mullvadvpn-b331dce20b0fb84d9e200bcff1748d60f4f84f75.zip | |
Remove split tunnel driver service path check
Diffstat (limited to 'talpid-core')
| -rw-r--r-- | talpid-core/src/split_tunnel/windows/service.rs | 40 |
1 files changed, 2 insertions, 38 deletions
diff --git a/talpid-core/src/split_tunnel/windows/service.rs b/talpid-core/src/split_tunnel/windows/service.rs index 95756acca8..93a8a03ae4 100644 --- a/talpid-core/src/split_tunnel/windows/service.rs +++ b/talpid-core/src/split_tunnel/windows/service.rs @@ -1,7 +1,7 @@ use std::{ ffi::{OsStr, OsString}, io, - path::{Path, PathBuf}, + path::Path, time::Duration, }; use windows_service::{ @@ -37,10 +37,6 @@ pub enum Error { #[error("Failed to query service status")] QueryServiceStatus(#[source] windows_service::Error), - /// Failed to open service config - #[error("Failed to retrieve service config")] - QueryServiceConfig(#[source] windows_service::Error), - /// Failed to install ST service #[error("Failed to install split tunnel driver")] InstallService(#[source] windows_service::Error), @@ -82,15 +78,7 @@ pub fn install_driver_if_required(resource_dir: &Path) -> Result<(), Error> { } }; - if expected_syspath != get_driver_binpath(&service)? { - log::debug!("ST driver is already installed"); - return start_and_wait_for_service(&service); - } - - log::debug!("Replacing ST driver due to unexpected path"); - - remove_device(service)?; - install_driver(&scm, &expected_syspath) + start_and_wait_for_service(&service) } pub fn stop_driver_service() -> Result<(), Error> { @@ -119,25 +107,6 @@ fn stop_service(service: &Service) -> Result<(), Error> { wait_for_status(service, ServiceState::Stopped) } -fn remove_device(service: Service) -> Result<(), Error> { - reset_driver(&service)?; - stop_service(&service)?; - let _ = service.delete(); - Ok(()) -} - -fn reset_driver(service: &Service) -> Result<(), Error> { - let status = service.query_status().map_err(Error::QueryServiceStatus)?; - - if status.current_state == ServiceState::Running { - let old_handle = - super::driver::DeviceHandle::new_handle_only().map_err(Error::OpenHandle)?; - old_handle.reset().map_err(Error::ResetDriver)?; - } - - Ok(()) -} - fn install_driver(scm: &ServiceManager, syspath: &Path) -> Result<(), Error> { log::debug!("Installing split tunnel driver"); @@ -197,8 +166,3 @@ fn wait_for_status(service: &Service, target_state: ServiceState) -> Result<(), Ok(()) } - -fn get_driver_binpath(service: &Service) -> Result<PathBuf, Error> { - let config = service.query_config().map_err(Error::QueryServiceConfig)?; - Ok(config.executable_path) -} |
