Skip to content

Commit

Permalink
Check if the block exists when downloading (#2357)
Browse files Browse the repository at this point in the history
* Check if block exists when downloading

* Update download progress when block exists
  • Loading branch information
feiniks authored Jul 21, 2020
1 parent 93f80b0 commit 562c0bd
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions daemon/http-tx-mgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -4420,6 +4420,20 @@ http_tx_task_download_file_blocks (HttpTxTask *task, const char *file_id)
char *block_id;
for (i = 0; i < file->n_blocks; ++i) {
block_id = file->blk_sha1s[i];
if (seaf_block_manager_block_exists (seaf->block_mgr,
task->repo_id, task->repo_version,
block_id)) {
BlockMetadata *bmd;
bmd = seaf_block_manager_stat_block (seaf->block_mgr,
task->repo_id, task->repo_version,
block_id);
if (bmd) {
task->done_download += bmd->size;
g_free (bmd);
continue;
}
}

ret = get_block (task, conn, block_id);
if (ret < 0 || task->state == HTTP_TASK_STATE_CANCELED)
break;
Expand Down

0 comments on commit 562c0bd

Please sign in to comment.