fix: address PR 212 review issues
CI / lint (pull_request) Successful in 30s
CI / sanitizers (address) (pull_request) Successful in 38s
CI / sanitizers (undefined) (pull_request) Successful in 38s
CI / fuzz-build (pull_request) Successful in 15s
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-08-15 12:48:31 +02:00
parent 298976aefb
commit 09454413d4
5 changed files with 101 additions and 47 deletions
+10 -5
View File
@@ -208,8 +208,11 @@ static int incremental_check(Client* client, File* file, const Config* config,
static int send_delta(Client* client, File* file, DeltaSignature* sig, Config* config) {
Delta* delta = delta_compute(file->data->data, file->data->size, sig, config->delta_block_size);
if (!delta)
if (!delta) {
if (!send_status(client->file_descriptor, STATUS_NEXT))
return -1;
return 1;
}
if (!delta_is_worthwhile(delta, file->data->size)) {
delta_destroy(delta);
@@ -506,9 +509,10 @@ static int load_files_multithreaded(void* pipeline_context) {
if (f->data->size > STREAM_THRESHOLD)
continue;
if (!file_load_data(f)) {
log_message(LOG_LEVEL_ERROR, "Failed to load file data, skipping");
file_destroy(f);
chunk->items[i] = NULL;
log_message(LOG_LEVEL_ERROR, "Failed to load file data");
chunk_destroy(chunk);
pipeline_cancel(context);
return thrd_error;
}
}
}
@@ -615,7 +619,8 @@ int send_files(Config* config) {
continue;
if (!file_load_data(f)) {
log_message(LOG_LEVEL_ERROR, "Failed to load file data");
continue;
chunk_destroy(current_chunk);
goto send_fail;
}
}
}
+5
View File
@@ -363,6 +363,8 @@ static int parallel_worker_thread(void* arg) {
cnd_broadcast(&wa->ps->result_not_empty);
cnd_broadcast(&wa->ps->result_not_full);
mtx_unlock(&wa->ps->result_mutex);
for (int j = i; j < wa->dir_count; j++)
free(wa->dirs[j]);
break;
}
Chunk* chunk;
@@ -588,6 +590,7 @@ ParallelScanner* parallel_scanner_create_with_options(const char* root_directory
ParallelWorkerArg* wa = calloc(1, sizeof(ParallelWorkerArg));
if (!wa) {
ps->failed = true;
ps->expected_threads = ps->created_threads;
break;
}
wa->ps = ps;
@@ -595,6 +598,7 @@ ParallelScanner* parallel_scanner_create_with_options(const char* root_directory
if (!wa->dirs) {
free(wa);
ps->failed = true;
ps->expected_threads = ps->created_threads;
break;
}
bool dup_ok = true;
@@ -609,6 +613,7 @@ ParallelScanner* parallel_scanner_create_with_options(const char* root_directory
free(wa->dirs);
free(wa);
ps->failed = true;
ps->expected_threads = ps->created_threads;
break;
}
wa->dir_count = count;