mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-01-18 07:43:01 +08:00
enable serde feature of bytes, modify struct WriteBlock using Bytes
This commit is contained in:
parent
16b7c7c716
commit
9ab955bb8e
@ -55,7 +55,7 @@ rpassword = "7.0"
|
|||||||
base64 = "0.13"
|
base64 = "0.13"
|
||||||
sysinfo = "0.24"
|
sysinfo = "0.24"
|
||||||
num_cpus = "1.13"
|
num_cpus = "1.13"
|
||||||
bytes = "1.2"
|
bytes = { version = "1.2", features = ["serde"] }
|
||||||
default-net = "0.11.0"
|
default-net = "0.11.0"
|
||||||
wol-rs = "0.9.1"
|
wol-rs = "0.9.1"
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ protobuf = { version = "3.1", features = ["with-bytes"] }
|
|||||||
tokio = { version = "1.20", features = ["full"] }
|
tokio = { version = "1.20", features = ["full"] }
|
||||||
tokio-util = { version = "0.7", features = ["full"] }
|
tokio-util = { version = "0.7", features = ["full"] }
|
||||||
futures = "0.3"
|
futures = "0.3"
|
||||||
bytes = "1.2"
|
bytes = { version = "1.2", features = ["serde"] }
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
env_logger = "0.9"
|
env_logger = "0.9"
|
||||||
socket2 = { version = "0.3", features = ["reuseport"] }
|
socket2 = { version = "0.3", features = ["reuseport"] }
|
||||||
|
@ -17,6 +17,7 @@ use parity_tokio_ipc::{
|
|||||||
};
|
};
|
||||||
use serde_derive::{Deserialize, Serialize};
|
use serde_derive::{Deserialize, Serialize};
|
||||||
use std::{collections::HashMap, sync::atomic::Ordering};
|
use std::{collections::HashMap, sync::atomic::Ordering};
|
||||||
|
use bytes::Bytes;
|
||||||
#[cfg(not(windows))]
|
#[cfg(not(windows))]
|
||||||
use std::{fs::File, io::prelude::*};
|
use std::{fs::File, io::prelude::*};
|
||||||
|
|
||||||
@ -63,7 +64,7 @@ pub enum FS {
|
|||||||
WriteBlock {
|
WriteBlock {
|
||||||
id: i32,
|
id: i32,
|
||||||
file_num: i32,
|
file_num: i32,
|
||||||
data: Vec<u8>,
|
data: Bytes,
|
||||||
compressed: bool,
|
compressed: bool,
|
||||||
},
|
},
|
||||||
WriteDone {
|
WriteDone {
|
||||||
|
@ -1063,7 +1063,7 @@ impl Connection {
|
|||||||
self.send_fs(ipc::FS::WriteBlock {
|
self.send_fs(ipc::FS::WriteBlock {
|
||||||
id: block.id,
|
id: block.id,
|
||||||
file_num: block.file_num,
|
file_num: block.file_num,
|
||||||
data: block.data.into(),
|
data: block.data,
|
||||||
compressed: block.compressed,
|
compressed: block.compressed,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -1363,8 +1363,8 @@ async fn start_ipc(
|
|||||||
file_num,
|
file_num,
|
||||||
data,
|
data,
|
||||||
compressed}) = data {
|
compressed}) = data {
|
||||||
stream.send(&Data::FS(ipc::FS::WriteBlock{id, file_num, data: Vec::new(), compressed})).await?;
|
stream.send(&Data::FS(ipc::FS::WriteBlock{id, file_num, data: Bytes::new(), compressed})).await?;
|
||||||
stream.send_raw(data).await?;
|
stream.send_raw(data.into()).await?;
|
||||||
} else {
|
} else {
|
||||||
stream.send(&data).await?;
|
stream.send(&data).await?;
|
||||||
}
|
}
|
||||||
|
@ -263,7 +263,7 @@ impl ConnectionManager {
|
|||||||
FileTransferBlock {
|
FileTransferBlock {
|
||||||
id,
|
id,
|
||||||
file_num,
|
file_num,
|
||||||
data: data.into(),
|
data,
|
||||||
compressed,
|
compressed,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user