mirror of
https://gitlab.com/marcandre.lureau/qemu-display.git
synced 2024-12-22 05:35:20 +00:00
rdp: quit when dbus service is gone
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
parent
b66058aefb
commit
6ad37b1f61
@ -209,6 +209,10 @@ impl<'d> Display<'d> {
|
||||
.await
|
||||
}
|
||||
|
||||
pub fn inner_proxy(&self) -> &zbus::Proxy<'d> {
|
||||
self.inner.proxy.inner()
|
||||
}
|
||||
|
||||
pub async fn receive_owner_changed(&self) -> Result<OwnerChangedStream<'_>> {
|
||||
Ok(self.inner.proxy.inner().receive_owner_changed().await?)
|
||||
}
|
||||
|
@ -25,3 +25,4 @@ ironrdp = { git = "https://github.com/Devolutions/IronRDP", features = [
|
||||
"displaycontrol",
|
||||
"rdpsnd"
|
||||
] }
|
||||
futures-util = "0.3"
|
||||
|
@ -4,7 +4,10 @@ mod input;
|
||||
mod sound;
|
||||
|
||||
use anyhow::{anyhow, Context, Error};
|
||||
use ironrdp::server::tokio_rustls::{rustls, TlsAcceptor};
|
||||
use ironrdp::server::{
|
||||
tokio_rustls::{rustls, TlsAcceptor},
|
||||
ServerEvent,
|
||||
};
|
||||
|
||||
use qemu_display::{zbus, Display};
|
||||
use rustls_pemfile::{certs, pkcs8_private_keys};
|
||||
@ -61,6 +64,16 @@ impl Server {
|
||||
.with_sound_factory(sound.map(|h| Box::new(h) as _))
|
||||
.build();
|
||||
|
||||
let ev = server.event_sender().clone();
|
||||
let proxy = dbus_display.inner_proxy().clone();
|
||||
tokio::spawn(async move {
|
||||
use futures_util::StreamExt;
|
||||
|
||||
let mut owner_changed = proxy.receive_owner_changed().await.unwrap();
|
||||
let _ = owner_changed.next().await;
|
||||
ev.send(ServerEvent::Quit("org.qemu is gone".to_owned()))
|
||||
.unwrap();
|
||||
});
|
||||
server.run().await
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user