cm handle auth status

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou 2022-11-04 19:02:03 +08:00
parent ea238337c4
commit ede24bf2c4

View File

@ -58,6 +58,7 @@ struct IpcTaskRunner<T: InvokeUiCM> {
rx: mpsc::UnboundedReceiver<Data>,
close: bool,
running: bool,
authorized: bool,
conn_id: i32,
#[cfg(windows)]
file_transfer_enabled: bool,
@ -275,7 +276,7 @@ impl<T: InvokeUiCM> IpcTaskRunner<T> {
let mut rx_clip;
let _tx_clip;
#[cfg(windows)]
if self.conn_id > 0 {
if self.conn_id > 0 && self.authorized {
rx_clip1 = clipboard::get_rx_cliprdr_server(self.conn_id);
rx_clip = rx_clip1.lock().await;
} else {
@ -303,6 +304,7 @@ impl<T: InvokeUiCM> IpcTaskRunner<T> {
Data::Login{id, is_file_transfer, port_forward, peer_id, name, authorized, keyboard, clipboard, audio, file, file_transfer_enabled: _file_transfer_enabled, restart, recording} => {
log::debug!("conn_id: {}", id);
self.cm.add_connection(id, is_file_transfer, port_forward, peer_id, name, authorized, keyboard, clipboard, audio, file, restart, recording, self.tx.clone());
self.authorized = authorized;
self.conn_id = id;
#[cfg(windows)]
{
@ -394,6 +396,7 @@ impl<T: InvokeUiCM> IpcTaskRunner<T> {
rx,
close: true,
running: true,
authorized: false,
conn_id: 0,
#[cfg(windows)]
file_transfer_enabled: false,