mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
improve file write to cm
This commit is contained in:
@@ -1157,7 +1157,15 @@ async fn start_ipc(
|
||||
res = rx_to_cm.recv() => {
|
||||
match res {
|
||||
Some(data) => {
|
||||
stream.send(&data).await?;
|
||||
if let Data::FS(ipc::FS::WriteBlock{id,
|
||||
file_num,
|
||||
data,
|
||||
compressed}) = data {
|
||||
stream.send(&Data::FS(ipc::FS::WriteBlock{id, file_num, data: Vec::new(), compressed})).await?;
|
||||
stream.send_raw(data).await?;
|
||||
} else {
|
||||
stream.send(&data).await?;
|
||||
}
|
||||
}
|
||||
None => {
|
||||
bail!("expected");
|
||||
|
||||
22
src/ui/cm.rs
22
src/ui/cm.rs
@@ -175,15 +175,23 @@ impl ConnectionManager {
|
||||
data,
|
||||
compressed,
|
||||
} => {
|
||||
let raw = if let Ok(bytes) = conn.next_raw().await {
|
||||
Some(bytes)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
if let Some(job) = fs::get_job(id, write_jobs) {
|
||||
if let Err(err) = job
|
||||
.write(FileTransferBlock {
|
||||
id,
|
||||
file_num,
|
||||
data,
|
||||
compressed,
|
||||
..Default::default()
|
||||
})
|
||||
.write(
|
||||
FileTransferBlock {
|
||||
id,
|
||||
file_num,
|
||||
data,
|
||||
compressed,
|
||||
..Default::default()
|
||||
},
|
||||
raw.as_ref().map(|x| &x[..]),
|
||||
)
|
||||
.await
|
||||
{
|
||||
Self::send(fs::new_error(id, err, file_num), conn).await;
|
||||
|
||||
@@ -1797,7 +1797,7 @@ impl Remote {
|
||||
}
|
||||
Some(file_response::Union::block(block)) => {
|
||||
if let Some(job) = fs::get_job(block.id, &mut self.write_jobs) {
|
||||
if let Err(_err) = job.write(block).await {
|
||||
if let Err(_err) = job.write(block, None).await {
|
||||
// to-do: add "skip" for writing job
|
||||
}
|
||||
self.update_jobs_status();
|
||||
|
||||
Reference in New Issue
Block a user