mirror of
https://github.com/rustdesk/rustdesk.git
synced 2024-11-24 20:59:37 +08:00
Do not sync file clipboard before conn
Signed-off-by: dignow <linlong1265@gmail.com>
This commit is contained in:
parent
9b7e5b38ad
commit
9ca01b0898
@ -70,7 +70,6 @@ struct MsgChannel {
|
||||
lazy_static::lazy_static! {
|
||||
static ref VEC_MSG_CHANNEL: RwLock<Vec<MsgChannel>> = Default::default();
|
||||
static ref CLIENT_CONN_ID_COUNTER: Mutex<i32> = Mutex::new(0);
|
||||
static ref LAST_FILE_FORMAT_LIST: Arc<Mutex<Option<ClipboardFile>>> = Default::default();
|
||||
}
|
||||
|
||||
impl ClipboardFile {
|
||||
@ -91,11 +90,6 @@ impl ClipboardFile {
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn get_last_file_format_list() -> Option<ClipboardFile> {
|
||||
LAST_FILE_FORMAT_LIST.lock().unwrap().clone()
|
||||
}
|
||||
|
||||
pub fn get_client_conn_id(session_uuid: &SessionID) -> Option<i32> {
|
||||
VEC_MSG_CHANNEL
|
||||
.read()
|
||||
@ -187,24 +181,46 @@ pub fn server_clip_file(
|
||||
ClipboardFile::MonitorReady => {
|
||||
log::debug!("server_monitor_ready called");
|
||||
ret = server_monitor_ready(context, conn_id);
|
||||
log::debug!("server_monitor_ready called, conn_id {}, return {}", conn_id, ret);
|
||||
log::debug!(
|
||||
"server_monitor_ready called, conn_id {}, return {}",
|
||||
conn_id,
|
||||
ret
|
||||
);
|
||||
}
|
||||
ClipboardFile::FormatList { format_list } => {
|
||||
log::debug!("server_format_list called, conn_id {}, format_list: {:?}", conn_id, &format_list);
|
||||
log::debug!(
|
||||
"server_format_list called, conn_id {}, format_list: {:?}",
|
||||
conn_id,
|
||||
&format_list
|
||||
);
|
||||
ret = server_format_list(context, conn_id, format_list);
|
||||
log::debug!("server_format_list called, conn_id {}, return {}", conn_id, ret);
|
||||
log::debug!(
|
||||
"server_format_list called, conn_id {}, return {}",
|
||||
conn_id,
|
||||
ret
|
||||
);
|
||||
}
|
||||
ClipboardFile::FormatListResponse { msg_flags } => {
|
||||
log::debug!("server_format_list_response called");
|
||||
ret = server_format_list_response(context, conn_id, msg_flags);
|
||||
log::debug!("server_format_list_response called, conn_id {}, msg_flags {}, return {}", conn_id, msg_flags, ret);
|
||||
log::debug!(
|
||||
"server_format_list_response called, conn_id {}, msg_flags {}, return {}",
|
||||
conn_id,
|
||||
msg_flags,
|
||||
ret
|
||||
);
|
||||
}
|
||||
ClipboardFile::FormatDataRequest {
|
||||
requested_format_id,
|
||||
} => {
|
||||
log::debug!("server_format_data_request called");
|
||||
ret = server_format_data_request(context, conn_id, requested_format_id);
|
||||
log::debug!("server_format_data_request called, conn_id {}, requested_format_id {}, return {}", conn_id, requested_format_id, ret);
|
||||
log::debug!(
|
||||
"server_format_data_request called, conn_id {}, requested_format_id {}, return {}",
|
||||
conn_id,
|
||||
requested_format_id,
|
||||
ret
|
||||
);
|
||||
}
|
||||
ClipboardFile::FormatDataResponse {
|
||||
msg_flags,
|
||||
@ -565,9 +581,12 @@ extern "C" fn client_format_list(
|
||||
}
|
||||
conn_id = (*clip_format_list).connID as i32;
|
||||
}
|
||||
log::debug!("client_format_list called, client id: {}, format_list: {:?}", conn_id, &format_list);
|
||||
log::debug!(
|
||||
"client_format_list called, client id: {}, format_list: {:?}",
|
||||
conn_id,
|
||||
&format_list
|
||||
);
|
||||
let data = ClipboardFile::FormatList { format_list };
|
||||
*LAST_FILE_FORMAT_LIST.lock().unwrap() = Some(data.clone());
|
||||
// no need to handle result here
|
||||
if conn_id == 0 {
|
||||
// msg_channel is used for debug, VEC_MSG_CHANNEL cannot be inspected by the debugger.
|
||||
@ -592,7 +611,11 @@ extern "C" fn client_format_list_response(
|
||||
conn_id = (*format_list_response).connID as i32;
|
||||
msg_flags = (*format_list_response).msgFlags as i32;
|
||||
}
|
||||
log::debug!("client_format_list_response called, client id: {}, msg_flags: {}", conn_id, msg_flags);
|
||||
log::debug!(
|
||||
"client_format_list_response called, client id: {}, msg_flags: {}",
|
||||
conn_id,
|
||||
msg_flags
|
||||
);
|
||||
let data = ClipboardFile::FormatListResponse { msg_flags };
|
||||
send_data(conn_id, data);
|
||||
|
||||
@ -612,7 +635,11 @@ extern "C" fn client_format_data_request(
|
||||
let data = ClipboardFile::FormatDataRequest {
|
||||
requested_format_id,
|
||||
};
|
||||
log::debug!("client_format_data_request called, conn_id: {}, requested_format_id: {}", conn_id, requested_format_id);
|
||||
log::debug!(
|
||||
"client_format_data_request called, conn_id: {}, requested_format_id: {}",
|
||||
conn_id,
|
||||
requested_format_id
|
||||
);
|
||||
// no need to handle result here
|
||||
send_data(conn_id, data);
|
||||
|
||||
@ -639,7 +666,11 @@ extern "C" fn client_format_data_response(
|
||||
.to_vec();
|
||||
}
|
||||
}
|
||||
log::debug!("client_format_data_response called, client id: {}, msg_flags: {}", conn_id, msg_flags);
|
||||
log::debug!(
|
||||
"client_format_data_response called, client id: {}, msg_flags: {}",
|
||||
conn_id,
|
||||
msg_flags
|
||||
);
|
||||
let data = ClipboardFile::FormatDataResponse {
|
||||
msg_flags,
|
||||
format_data,
|
||||
@ -726,7 +757,12 @@ extern "C" fn client_file_contents_response(
|
||||
stream_id,
|
||||
requested_data,
|
||||
};
|
||||
log::debug!("client_file_contents_response called, conn_id: {}, msg_flags: {}, stream_id: {}", conn_id, msg_flags, stream_id);
|
||||
log::debug!(
|
||||
"client_file_contents_response called, conn_id: {}, msg_flags: {}, stream_id: {}",
|
||||
conn_id,
|
||||
msg_flags,
|
||||
stream_id
|
||||
);
|
||||
send_data(conn_id, data);
|
||||
|
||||
0
|
||||
|
@ -6,9 +6,7 @@ use std::sync::{
|
||||
};
|
||||
|
||||
#[cfg(windows)]
|
||||
use clipboard::{
|
||||
cliprdr::CliprdrClientContext, empty_clipboard, get_last_file_format_list, ContextSend,
|
||||
};
|
||||
use clipboard::{cliprdr::CliprdrClientContext, empty_clipboard, ContextSend};
|
||||
use crossbeam_queue::ArrayQueue;
|
||||
use hbb_common::config::{PeerConfig, TransferSerde};
|
||||
use hbb_common::fs::{
|
||||
@ -1053,13 +1051,6 @@ impl<T: InvokeUiSession> Remote<T> {
|
||||
}
|
||||
|
||||
self.is_connected = true;
|
||||
#[cfg(target_os = "windows")]
|
||||
if self.handler.peer_platform() == crate::platform::PLATFORM_WINDOWS {
|
||||
if let Some(last_file_format_list) = get_last_file_format_list() {
|
||||
self.handle_local_clipboard_msg(peer, Some(last_file_format_list))
|
||||
.await;
|
||||
}
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user