From e253263cbef7b4c7e9006b71ce7b6b06cf87d081 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Ciarcin=CC=81ski?= Date: Mon, 24 Nov 2025 13:24:01 +0100 Subject: [PATCH] Cleanup for Windows --- .../src/enterprise/service_locations/windows.rs | 2 +- src-tauri/src/service/client.rs | 12 +++++++++--- src-tauri/src/service/utils.rs | 7 ------- src-tauri/src/service/windows.rs | 6 +++++- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src-tauri/src/enterprise/service_locations/windows.rs b/src-tauri/src/enterprise/service_locations/windows.rs index 74c6b240..53f6ce67 100644 --- a/src-tauri/src/enterprise/service_locations/windows.rs +++ b/src-tauri/src/enterprise/service_locations/windows.rs @@ -30,8 +30,8 @@ use crate::{ SingleServiceLocationData, }, service::{ + daemon::setup_wgapi, proto::{ServiceLocation, ServiceLocationMode}, - setup_wgapi, }, }; diff --git a/src-tauri/src/service/client.rs b/src-tauri/src/service/client.rs index 1e266cb3..abf9afb1 100644 --- a/src-tauri/src/service/client.rs +++ b/src-tauri/src/service/client.rs @@ -1,16 +1,22 @@ use std::sync::LazyLock; use hyper_util::rt::TokioIo; +#[cfg(windows)] +use tokio::net::windows::named_pipe::ClientOptions; #[cfg(unix)] use tokio::net::UnixStream; use tonic::transport::channel::{Channel, Endpoint}; #[cfg(unix)] use tonic::transport::Uri; use tower::service_fn; +#[cfg(windows)] +use windows_sys::Win32::Foundation::ERROR_PIPE_BUSY; -use super::{ - daemon::DAEMON_SOCKET_PATH, proto::desktop_daemon_service_client::DesktopDaemonServiceClient, -}; +#[cfg(unix)] +use super::daemon::DAEMON_SOCKET_PATH; +#[cfg(windows)] +use super::named_pipe::PIPE_NAME; +use super::proto::desktop_daemon_service_client::DesktopDaemonServiceClient; pub(crate) static DAEMON_CLIENT: LazyLock> = LazyLock::new(|| { diff --git a/src-tauri/src/service/utils.rs b/src-tauri/src/service/utils.rs index 920f2f9d..7796cf56 100644 --- a/src-tauri/src/service/utils.rs +++ b/src-tauri/src/service/utils.rs @@ -1,18 +1,11 @@ use std::io::stdout; -#[cfg(windows)] -use tokio::net::windows::named_pipe::ClientOptions; use tracing::Level; use tracing_appender::non_blocking::WorkerGuard; use tracing_subscriber::{ fmt, fmt::writer::MakeWriterExt, layer::SubscriberExt, util::SubscriberInitExt, EnvFilter, Layer, }; -#[cfg(windows)] -use windows_sys::Win32::Foundation::ERROR_PIPE_BUSY; - -#[cfg(windows)] -use crate::service::named_pipe::PIPE_NAME; pub fn logging_setup(log_dir: &str, log_level: &str) -> WorkerGuard { // prepare log file appender diff --git a/src-tauri/src/service/windows.rs b/src-tauri/src/service/windows.rs index 512c623c..b843cf58 100644 --- a/src-tauri/src/service/windows.rs +++ b/src-tauri/src/service/windows.rs @@ -22,7 +22,11 @@ use crate::{ enterprise::service_locations::{ windows::watch_for_login_logoff, ServiceLocationError, ServiceLocationManager, }, - service::{run_server, utils::logging_setup, Config, DaemonError}, + service::{ + config::Config, + daemon::{run_server, DaemonError}, + utils::logging_setup, + }, }; static SERVICE_NAME: &str = "DefguardService";