daemon/root: Fix state loading

This commit is contained in:
Vicki Pfau 2024-06-12 18:01:49 -07:00
parent 5b8deecd45
commit a56101c71c
2 changed files with 8 additions and 5 deletions

View file

@ -13,7 +13,7 @@ use tokio::signal::unix::{signal, SignalKind};
use tokio::sync::mpsc::{self, Receiver, Sender}; use tokio::sync::mpsc::{self, Receiver, Sender};
use tokio::task::JoinSet; use tokio::task::JoinSet;
use tokio_util::sync::CancellationToken; use tokio_util::sync::CancellationToken;
use tracing::{error, info}; use tracing::{debug, error, info};
use tracing_subscriber::layer::SubscriberExt; use tracing_subscriber::layer::SubscriberExt;
use tracing_subscriber::registry::LookupSpan; use tracing_subscriber::registry::LookupSpan;
use zbus::connection::Connection; use zbus::connection::Connection;
@ -109,6 +109,7 @@ impl<C: DaemonContext> Daemon<C> {
let state = read_state(&context).await?; let state = read_state(&context).await?;
let config = read_config(&context).await?; let config = read_config(&context).await?;
debug!("Starting daemon with state: {state:#?}, config: {config:#?}");
context.start(state, config, self).await?; context.start(state, config, self).await?;
let mut res = loop { let mut res = loop {

View file

@ -109,16 +109,18 @@ impl DaemonContext for RootContext {
} }
fn state(&self) -> RootState { fn state(&self) -> RootState {
RootState::default() self.state
} }
async fn start( async fn start(
&mut self, &mut self,
_state: RootState, state: RootState,
_config: RootConfig, _config: RootConfig,
_daemon: &mut Daemon<RootContext>, daemon: &mut Daemon<RootContext>,
) -> Result<()> { ) -> Result<()> {
// Nothing to do yet self.state = state;
self.reload_ds_inhibit(daemon).await?;
Ok(()) Ok(())
} }