init sync file clipboard, local to remote

Signed-off-by: dignow <linlong1265@gmail.com>
This commit is contained in:
dignow
2023-07-31 21:40:55 +08:00
parent 433059f8a0
commit 4009fd77e8
4 changed files with 66 additions and 24 deletions

View File

@@ -70,6 +70,7 @@ 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 {
@@ -90,6 +91,11 @@ 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()
@@ -561,6 +567,7 @@ extern "C" fn client_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.