mirror of
https://gitlab.steamos.cloud/holo/steamos-manager.git
synced 2025-07-12 01:12:30 -04:00
daemon: Hold onto and expose connection object
This commit is contained in:
parent
b51569b657
commit
38d52626e8
1 changed files with 6 additions and 0 deletions
|
@ -60,6 +60,7 @@ pub(crate) trait DaemonContext: Sized {
|
||||||
pub(crate) struct Daemon<C: DaemonContext> {
|
pub(crate) struct Daemon<C: DaemonContext> {
|
||||||
services: JoinSet<Result<()>>,
|
services: JoinSet<Result<()>>,
|
||||||
token: CancellationToken,
|
token: CancellationToken,
|
||||||
|
connection: Connection,
|
||||||
channel: Receiver<DaemonCommand<C::Command>>,
|
channel: Receiver<DaemonCommand<C::Command>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,6 +91,7 @@ impl<C: DaemonContext> Daemon<C> {
|
||||||
services,
|
services,
|
||||||
token,
|
token,
|
||||||
channel,
|
channel,
|
||||||
|
connection,
|
||||||
};
|
};
|
||||||
daemon.add_service(log_receiver);
|
daemon.add_service(log_receiver);
|
||||||
|
|
||||||
|
@ -104,6 +106,10 @@ impl<C: DaemonContext> Daemon<C> {
|
||||||
token
|
token
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) fn get_connection(&self) -> Connection {
|
||||||
|
self.connection.clone()
|
||||||
|
}
|
||||||
|
|
||||||
pub(crate) async fn run(&mut self, mut context: C) -> Result<()> {
|
pub(crate) async fn run(&mut self, mut context: C) -> Result<()> {
|
||||||
ensure!(
|
ensure!(
|
||||||
!self.services.is_empty(),
|
!self.services.is_empty(),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue