libgreetd_stub/lib.rs
1mod data;
2mod server;
3mod session;
4
5use std::{fs, path::Path};
6
7use tokio::net::UnixListener;
8
9pub use crate::session::SessionOptions;
10
11pub async fn start<P>(socket: P, opts: &SessionOptions)
12where
13 P: AsRef<Path>,
14{
15 let _ = fs::remove_file(&socket);
16 let listener = UnixListener::bind(socket).unwrap();
17
18 tracing::info!("starting greetd stub");
19
20 loop {
21 if let Ok((stream, _)) = listener.accept().await {
22 server::handle(stream, opts).await;
23 }
24 }
25}