mirror of
https://gitlab.steamos.cloud/holo/steamos-manager.git
synced 2025-07-09 16:10:34 -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> {
|
||||
services: JoinSet<Result<()>>,
|
||||
token: CancellationToken,
|
||||
connection: Connection,
|
||||
channel: Receiver<DaemonCommand<C::Command>>,
|
||||
}
|
||||
|
||||
|
@ -90,6 +91,7 @@ impl<C: DaemonContext> Daemon<C> {
|
|||
services,
|
||||
token,
|
||||
channel,
|
||||
connection,
|
||||
};
|
||||
daemon.add_service(log_receiver);
|
||||
|
||||
|
@ -104,6 +106,10 @@ impl<C: DaemonContext> Daemon<C> {
|
|||
token
|
||||
}
|
||||
|
||||
pub(crate) fn get_connection(&self) -> Connection {
|
||||
self.connection.clone()
|
||||
}
|
||||
|
||||
pub(crate) async fn run(&mut self, mut context: C) -> Result<()> {
|
||||
ensure!(
|
||||
!self.services.is_empty(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue