feat: add whole-file transfer mode
CI / lint (pull_request) Successful in 11s
CI / sanitizers (address) (pull_request) Successful in 38s
CI / sanitizers (undefined) (pull_request) Successful in 38s
CI / fuzz-build (pull_request) Successful in 14s
CI / coverage (pull_request) Successful in 32s
CI / build-and-test (pull_request) Successful in 1m15s
CI / valgrind (pull_request) Successful in 33s

This commit is contained in:
2026-09-03 16:47:02 +02:00
parent 190fc5d300
commit c91db3266a
9 changed files with 53 additions and 3 deletions
+1
View File
@@ -140,6 +140,7 @@ static const OptionEntry OPTION_TABLE[] = {
{"--delete", NULL, OPT_FLAG, offsetof(Config, use_delete)},
{"--incremental", NULL, OPT_FLAG, offsetof(Config, use_incremental)},
{"--delta", NULL, OPT_FLAG, offsetof(Config, use_delta)},
{"--whole-file", "-W", OPT_FLAG, offsetof(Config, whole_file)},
{"--save-to-disk", NULL, OPT_FLAG, offsetof(Config, save_to_disk)},
{"--progress", NULL, OPT_FLAG, offsetof(Config, show_progress)},
{"--tls", NULL, OPT_FLAG, offsetof(Config, use_tls)},
+1 -1
View File
@@ -321,7 +321,7 @@ static int send_single_file(Client* client, File* file, Config* config, bool use
delta_signature_destroy(sig);
return 1;
}
if (rc == 2 && config->use_delta) {
if (rc == 2 && config->use_delta && !config->whole_file) {
int drc = send_delta(client, file, sig, config);
delta_signature_destroy(sig);
if (drc == 0)
+1
View File
@@ -29,6 +29,7 @@ void print_usage(void) {
printf(" --min-size <n> Skip files smaller than n bytes\n");
printf(" --incremental Skip files unchanged since last transfer\n");
printf(" --delta Delta transfer for changed files (requires --incremental)\n");
printf(" -W, --whole-file Transfer changed files without delta processing\n");
printf(" --delta-block <n> Delta block size in bytes (default: %d)\n",
DELTA_BLOCK_SIZE_DEFAULT);
printf(" --delta-max <n> Max file size for delta transfer (default: %llu)\n",
+2 -1
View File
@@ -35,6 +35,7 @@ static void config_set_defaults(Config* config) {
config->min_size = 0;
config->use_incremental = false;
config->use_delta = false;
config->whole_file = false;
config->delta_block_size = DELTA_BLOCK_SIZE_DEFAULT;
config->delta_max_file_size = DELTA_MAX_FILE_SIZE;
config->use_tls = false;
@@ -228,7 +229,7 @@ static bool send_core_fields(int fd, const Config* c) {
static bool send_delta_fields(int fd, const Config* c) {
return send_int(fd, c->use_delete) && send_int(fd, c->use_incremental) &&
send_int(fd, c->use_delta) &&
send_int(fd, c->use_delta && !c->whole_file) &&
send_n_data(fd, &c->delta_block_size, sizeof(c->delta_block_size)) &&
send_n_data(fd, &c->delta_max_file_size, sizeof(unsigned long long));
}
+1
View File
@@ -35,6 +35,7 @@ typedef struct Config {
unsigned long long min_size;
bool use_incremental;
bool use_delta;
bool whole_file;
uint32_t delta_block_size;
unsigned long long delta_max_file_size;
bool use_tls;
+1 -1
View File
@@ -400,7 +400,7 @@ File* receive_incremental_check(int fd, const Config* config, bool* skipped) {
return NULL;
}
bool try_delta = config->use_delta && has_old_file && old_data != NULL &&
bool try_delta = config->use_delta && !config->whole_file && has_old_file && old_data != NULL &&
delta_should_attempt(old_size, check_size, config->delta_max_file_size);
if (try_delta) {