mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-28 03:49:20 +03:00
Add a threshold to httpbf before splitting the files
This commit is contained in:
parent
7a8b07443f
commit
75682f981d
4 changed files with 15 additions and 1 deletions
|
@ -1200,7 +1200,10 @@ static int owncloud_sendfile(csync_vio_method_handle_t *src, csync_vio_method_ha
|
|||
Hbf_State state = HBF_SUCCESS;
|
||||
hbf_transfer_t *trans = hbf_init_transfer(clean_uri);
|
||||
if (dav_session.hbf_block_size > 0) {
|
||||
trans->block_size = dav_session.hbf_block_size;
|
||||
trans->threshold = trans->block_size = dav_session.hbf_block_size;
|
||||
}
|
||||
if (dav_session.hbf_threshold > 0) {
|
||||
trans->threshold = dav_session.hbf_threshold;
|
||||
}
|
||||
finished = true;
|
||||
|
||||
|
@ -1756,6 +1759,10 @@ static int owncloud_set_property(const char *key, void *data) {
|
|||
dav_session.hbf_block_size = *(off_t*)(data);
|
||||
return 0;
|
||||
}
|
||||
if( c_streq(key, "hbf_threshold")) {
|
||||
dav_session.hbf_threshold = *(off_t*)(data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -152,6 +152,7 @@ struct dav_session_s {
|
|||
|
||||
bool no_recursive_propfind;
|
||||
off_t hbf_block_size;
|
||||
off_t hbf_threshold;
|
||||
};
|
||||
extern struct dav_session_s dav_session;
|
||||
|
||||
|
|
|
@ -87,6 +87,7 @@ hbf_transfer_t *hbf_init_transfer( const char *dest_uri ) {
|
|||
transfer->error_string = NULL;
|
||||
transfer->start_id = 0;
|
||||
transfer->block_size = DEFAULT_BLOCK_SIZE;
|
||||
transfer->threshold = transfer->block_size;
|
||||
|
||||
return transfer;
|
||||
}
|
||||
|
@ -122,6 +123,10 @@ Hbf_State hbf_splitlist(hbf_transfer_t *transfer, int fd ) {
|
|||
|
||||
/* calc the number of blocks to split in */
|
||||
blk_size = transfer->block_size;
|
||||
if (sb.st_size < transfer->threshold) {
|
||||
blk_size = transfer->threshold;
|
||||
}
|
||||
|
||||
num_blocks = sb.st_size / blk_size;
|
||||
|
||||
/* there migth be a remainder. */
|
||||
|
|
|
@ -92,6 +92,7 @@ struct hbf_transfer_s {
|
|||
off_t stat_size;
|
||||
time_t modtime;
|
||||
off_t block_size;
|
||||
off_t threshold;
|
||||
|
||||
hbf_abort_callback abort_cb;
|
||||
#ifndef NDEBUG
|
||||
|
|
Loading…
Reference in a new issue