refactor cliprdr, not tested on windows yet

This commit is contained in:
rustdesk
2022-02-15 14:46:08 +08:00
parent e407ba3a33
commit 933969d1fe
15 changed files with 114 additions and 49 deletions

View File

@@ -77,7 +77,8 @@ pub fn server_msg(context: &mut Box<CliprdrClientContext>, conn_id: ConnID, msg:
ret
}
None => {
unreachable!()
// unreachable!()
0
}
}
}

View File

@@ -318,11 +318,13 @@ message CliprdrFormat {
int32 id = 3;
string format = 4;
}
message CliprdrServerFormatList {
int32 server_conn_id = 1;
int32 remote_conn_id = 2;
repeated CliprdrFormat formats = 3;
}
message CliprdrServerFormatListResponse {
int32 server_conn_id = 1;
int32 remote_conn_id = 2;
@@ -334,6 +336,7 @@ message CliprdrServerFormatDataRequest {
int32 remote_conn_id = 2;
int32 requested_format_id = 3;
}
message CliprdrServerFormatDataResponse {
int32 server_conn_id = 1;
int32 remote_conn_id = 2;
@@ -353,6 +356,7 @@ message CliprdrFileContentsRequest {
bool have_clip_data_id = 9;
int32 clip_data_id = 10;
}
message CliprdrFileContentsResponse {
int32 server_conn_id = 1;
int32 remote_conn_id = 2;
@@ -386,6 +390,7 @@ message PermissionInfo {
Keyboard = 0;
Clipboard = 2;
Audio = 3;
File = 4;
}
Permission permission = 1;
@@ -413,6 +418,7 @@ message OptionMessage {
int32 custom_image_quality = 6;
BoolOption disable_audio = 7;
BoolOption disable_clipboard = 8;
BoolOption enable_file_transfer = 9;
}
message OptionResponse {

View File

@@ -139,6 +139,8 @@ pub struct PeerConfig {
pub disable_audio: bool,
#[serde(default)]
pub disable_clipboard: bool,
#[serde(default)]
pub enable_file_transfer: bool,
// the other scalar value must before this
#[serde(default)]

View File

@@ -84,7 +84,7 @@ impl FramedSocket {
let _ = match self {
Self::Direct(f) => match addr {
TargetAddr::Ip(addr) => f.send((send_data, addr)).await?,
_ => unreachable!(),
_ => {}
},
Self::ProxySocks(f) => f.send((send_data, addr)).await?,
};
@@ -103,7 +103,7 @@ impl FramedSocket {
let _ = match self {
Self::Direct(f) => match addr {
TargetAddr::Ip(addr) => f.send((Bytes::from(msg), addr)).await?,
_ => unreachable!(),
_ => {}
},
Self::ProxySocks(f) => f.send((Bytes::from(msg), addr)).await?,
};