This commit is contained in:
Kingtous 2022-05-12 14:16:06 +08:00
parent 74a3799b78
commit 83c75409e8
4 changed files with 21 additions and 2 deletions

View File

@ -264,6 +264,7 @@ message FileResponse {
FileTransferError error = 3;
FileTransferDone done = 4;
FileTransferDigest digest = 5;
FileTransferDirOffsetRequest offset = 6;
}
}

View File

@ -59,6 +59,11 @@ pub enum FS {
id: i32,
file_num: i32,
},
WriteOffset {
id: i32,
file_num: i32,
offset_blk: u32
},
CheckDigest {
id: i32,
file_num: i32,

View File

@ -1053,6 +1053,14 @@ impl Connection {
last_modified: d.last_modified,
is_upload: true,
}),
Some(file_response::Union::offset(offset)) => {
// TODO: i32
// self.send_fs(ipc::FS::WriteOffset {
// id: offset.id,
// file_num: offset.file_num,
// offset_blk: offset.offset_blk,
// });
}
_ => {}
},
Some(message::Union::misc(misc)) => match misc.union {

View File

@ -1319,7 +1319,7 @@ async fn io_loop(handler: Handler) {
clipboard_file_context: None,
};
remote.io_loop(&key, &token).await;
remote.sync_jobs_status_to_local();
remote.sync_jobs_status_to_local().await;
}
struct RemoveJob {
@ -1452,7 +1452,7 @@ impl Remote {
}
}
}
self.sync_jobs_status_to_local();
self.sync_jobs_status_to_local().await;
log::debug!("Exit io_loop of id={}", self.handler.id);
}
Err(err) => {
@ -1798,6 +1798,7 @@ impl Remote {
}
async fn sync_jobs_status_to_local(&mut self) -> bool {
println!("sync job status");
let mut config: PeerConfig = self.handler.load_config();
let mut transfer_metas = TransferSerde::default();
for job in self.read_jobs.iter() {
@ -1896,6 +1897,10 @@ impl Remote {
job.files = entries;
}
}
Some(file_response::Union::offset(offset)) => {
// TODO: offset
// upload
}
Some(file_response::Union::digest(digest)) => {
if digest.is_upload {
if let Some(job) = fs::get_job(digest.id, &mut self.read_jobs) {