mirror of
https://gitlab.com/marcandre.lureau/qemu-display.git
synced 2024-12-22 05:35:20 +00:00
rdp: disconnect update listener when the client is gone
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
parent
3b282c440a
commit
2432ee97f3
@ -2,7 +2,10 @@
|
|||||||
use crate::win32::Fd;
|
use crate::win32::Fd;
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
use std::os::unix::net::UnixStream;
|
use std::os::unix::net::UnixStream;
|
||||||
use std::{convert::TryFrom, sync::RwLock};
|
use std::{
|
||||||
|
convert::TryFrom,
|
||||||
|
sync::{Arc, RwLock},
|
||||||
|
};
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
use uds_windows::UnixStream;
|
use uds_windows::UnixStream;
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
@ -50,7 +53,7 @@ pub trait Console {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(derivative::Derivative)]
|
#[derive(derivative::Derivative)]
|
||||||
#[derivative(Debug)]
|
#[derivative(Debug, Clone)]
|
||||||
pub struct Console {
|
pub struct Console {
|
||||||
#[derivative(Debug = "ignore")]
|
#[derivative(Debug = "ignore")]
|
||||||
pub proxy: ConsoleProxy<'static>,
|
pub proxy: ConsoleProxy<'static>,
|
||||||
@ -60,7 +63,7 @@ pub struct Console {
|
|||||||
pub mouse: MouseProxy<'static>,
|
pub mouse: MouseProxy<'static>,
|
||||||
#[derivative(Debug = "ignore")]
|
#[derivative(Debug = "ignore")]
|
||||||
pub multi_touch: MultiTouchProxy<'static>,
|
pub multi_touch: MultiTouchProxy<'static>,
|
||||||
listener: RwLock<Option<Connection>>,
|
listener: Arc<RwLock<Option<Connection>>>,
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
peer_pid: u32,
|
peer_pid: u32,
|
||||||
}
|
}
|
||||||
@ -83,7 +86,7 @@ impl Console {
|
|||||||
keyboard,
|
keyboard,
|
||||||
mouse,
|
mouse,
|
||||||
multi_touch,
|
multi_touch,
|
||||||
listener: RwLock::new(None),
|
listener: Arc::new(RwLock::new(None)),
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
peer_pid,
|
peer_pid,
|
||||||
})
|
})
|
||||||
|
@ -30,6 +30,13 @@ pub struct DisplayHandler {
|
|||||||
|
|
||||||
struct DisplayUpdates {
|
struct DisplayUpdates {
|
||||||
receiver: queue::Receiver,
|
receiver: queue::Receiver,
|
||||||
|
console: Console,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Drop for DisplayUpdates {
|
||||||
|
fn drop(&mut self) {
|
||||||
|
self.console.unregister_listener();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DisplayHandler {
|
impl DisplayHandler {
|
||||||
@ -52,7 +59,8 @@ impl DisplayHandler {
|
|||||||
#[cfg(any(windows, unix))]
|
#[cfg(any(windows, unix))]
|
||||||
self.console.set_map_listener(listener.clone()).await?;
|
self.console.set_map_listener(listener.clone()).await?;
|
||||||
|
|
||||||
Ok(DisplayUpdates { receiver })
|
let console = self.console.clone();
|
||||||
|
Ok(DisplayUpdates { receiver, console })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user