diff --git a/src/daemon/main.rs b/src/daemon/main.rs index 25b8db0..55d25e9 100644 --- a/src/daemon/main.rs +++ b/src/daemon/main.rs @@ -12,6 +12,7 @@ pub use sessions::{ }; use std::path::Path; +use std::time::Duration; #[cfg(unix)] use tokio::net::UnixListener; @@ -31,6 +32,18 @@ async fn main() -> Result<(), Box> { let uds = UnixListener::bind(libcommand::SOCK_FILE)?; let uds_stream = UnixListenerStream::new(uds); + std::thread::spawn(|| { + loop { + if let Ok(lock) = get_sessions_lock() { + println!("Sessions log"); + for session in lock.iter() { + println!("ID: {id}, PID: {pid}", id = session.id, pid = session.pid); + } + } + std::thread::sleep(Duration::from_millis(1000)); + } + }); + Server::builder() .add_service(UnixServer::new(server)) .serve_with_incoming(uds_stream)