INNER CODE UNIT · Rust

spawn_wakeup_listener

owu/wsl-dashboard · src/app/tasks/mod.rs:124

pub fn spawn_wakeup_listener(app_handle: slint::Weak<AppWindow>) {
    #[cfg(target_os = "windows")]
    tokio::spawn(async move {
        use tokio::net::windows::named_pipe::ServerOptions;
        let pipe_name = r"\\.\pipe\wsldashboard_wakeup_pipe_v0.3";
        loop {
            let server = match ServerOptions::new().create(pipe_name) {
                Ok(s) => s,
                Err(e) => {
                    tracing::error!("Failed to create named pipe server: {}", e);
                    tokio::time::sleep(std::time::Duration::from_secs(5)).await;
                    continue;
                }
            };

            if match server.connect().await {
                Ok(_) => true,
                Err(_) => false,

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…