kordophoned: better daemon bootstrapping
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user