Private
Public Access
1
0

kordophoned: better daemon bootstrapping

This commit is contained in:
2025-04-25 16:54:37 -07:00
parent b1f171136a
commit 0c6b55fa38
7 changed files with 202 additions and 67 deletions

View File

@@ -1,5 +1,5 @@
use log::info;
use std::sync::Arc;
use std::sync::{Arc, Mutex};
use crate::{daemon::Daemon, dbus::interface};
use dbus_crossroads::Crossroads;
@@ -13,11 +13,11 @@ use dbus::{
pub struct Endpoint {
connection: Arc<SyncConnection>,
daemon: Arc<Daemon>,
daemon: Arc<Mutex<Daemon>>,
}
impl Endpoint {
pub fn new(daemon: Arc<Daemon>) -> Self {
pub fn new(daemon: Daemon) -> Self {
let (resource, connection) = connection::new_session_sync().unwrap();
// The resource is a task that should be spawned onto a tokio compatible
@@ -29,7 +29,10 @@ impl Endpoint {
panic!("Lost connection to D-Bus: {}", err);
});
Self { connection, daemon }
Self {
connection,
daemon: Arc::new(Mutex::new(daemon))
}
}
pub async fn start(&self) {