mirror of
https://github.com/rustdesk/hbb_common.git
synced 2026-04-22 00:00:11 +00:00
fix: file transfer, resume, init finished size
Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
13
src/fs.rs
13
src/fs.rs
@@ -612,6 +612,19 @@ impl TransferJob {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn set_finished_size_on_resume(&mut self) {
|
||||||
|
if self.is_resume && self.file_num > 0 {
|
||||||
|
let finished_size: u64 = self
|
||||||
|
.files
|
||||||
|
.iter()
|
||||||
|
.take(self.file_num as usize)
|
||||||
|
.map(|file| file.size)
|
||||||
|
.sum();
|
||||||
|
self.finished_size = finished_size;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub async fn write(&mut self, block: FileTransferBlock) -> ResultType<()> {
|
pub async fn write(&mut self, block: FileTransferBlock) -> ResultType<()> {
|
||||||
if block.id != self.id {
|
if block.id != self.id {
|
||||||
bail!("Wrong id");
|
bail!("Wrong id");
|
||||||
|
|||||||
Reference in New Issue
Block a user