diff --git a/daemon/src/daemon.rs b/daemon/src/daemon.rs index 78318fc6..857aafb0 100644 --- a/daemon/src/daemon.rs +++ b/daemon/src/daemon.rs @@ -74,8 +74,7 @@ fn start_daemon() -> Result<(), Box> { let mut tasks: Vec> = Vec::new(); // Start zbus server let connection = Connection::new_system()?; - fdo::DBusProxy::new(&connection)? - .request_name(DBUS_NAME, fdo::RequestNameFlags::ReplaceExisting.into())?; + let fdo_connection = fdo::DBusProxy::new(&connection)?; let mut object_server = ObjectServer::new(&connection); let config = Config::load(); @@ -195,6 +194,9 @@ fn start_daemon() -> Result<(), Box> { // }) // .ok(); + // Request dbus name after finishing initalizing all functions + fdo_connection.request_name(DBUS_NAME, fdo::RequestNameFlags::ReplaceExisting.into())?; + // Loop to check errors and iterate zbus server loop { if let Err(err) = &handle {