refactor: extract receive_chunk_data and receive_manifest shared helpers

- receive_chunk_data(fd, config) -> Chunk*: shared receive/decompress/deserialize
  (eliminates ~25 lines of duplication between server.c and multiprocessing.c)
- receive_manifest(fd, config, next_status): moved from server.c to file.c,
  fixes missing 'Deleting files not in manifest...' log in multiprocessing.c
- Removes redundant manual free loop in multiprocessing.c manifest handling
  (array_list_create(free) destructor already handles this)
- server.c and multiprocessing.c: remove local chunk/manifest helpers,
  remove compression.h include (no longer needed)
This commit is contained in:
2026-07-18 17:00:11 +02:00
parent 5ed12f2bf0
commit 7876721906
6 changed files with 54 additions and 88 deletions
+2
View File
@@ -1,6 +1,7 @@
#ifndef CHUNK_H
#define CHUNK_H
#include "config.h"
#include "data.h"
#include "file.h"
#include <stdbool.h>
@@ -18,5 +19,6 @@ void chunk_destroy(void *chunk);
Data *chunk_serialize(Chunk *chunk, bool use_metadata);
Chunk *chunk_deserialize(Data *data, bool use_metadata);
Data *chunk_compress(Chunk *chunk, int compression_level, bool use_metadata);
Chunk *receive_chunk_data(int fd, Config *config);
#endif