From 95e3bded601a45e7107a95bd2f9bbc00b3d79d52 Mon Sep 17 00:00:00 2001 From: TapTap Date: Sat, 4 Jul 2026 20:28:00 +0200 Subject: [PATCH 1/4] Update shell.nix --- shell.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/shell.nix b/shell.nix index ada4520..ad1a267 100644 --- a/shell.nix +++ b/shell.nix @@ -8,6 +8,7 @@ pkgs.mkShell { cmake gnumake pkg-config + tea ]; buildInputs = with pkgs; [ From f4f9adb00764e7922dfc37c1b7beee5a31b5a8c7 Mon Sep 17 00:00:00 2001 From: TapTap Date: Sat, 4 Jul 2026 20:29:57 +0200 Subject: [PATCH 2/4] Update opencode.json --- opencode.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opencode.json b/opencode.json index 61bda2a..72d2c8b 100644 --- a/opencode.json +++ b/opencode.json @@ -2,7 +2,7 @@ "$schema": "https://opencode.ai/config.json", "permission": { "bash": { - "*": "ask", + "*": "allow", "git push origin main": "deny", "git push origin master": "deny", "git push *": "ask", From ae4c8ff9f0f2ccbbf70b788512f04bc6d6ad83dd Mon Sep 17 00:00:00 2001 From: TapTap Date: Sat, 4 Jul 2026 20:45:47 +0200 Subject: [PATCH 3/4] fix: remove some benchmarks so that its faster --- test.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test.py b/test.py index ffb4dc3..fa07496 100755 --- a/test.py +++ b/test.py @@ -36,10 +36,10 @@ CLIENT_CMD_PREFIX = [ TEST_CASES = [ {"name": "Standard (Single-threaded)", "flags": []}, {"name": "Multithreading (-m)", "flags": ["-m"]}, - {"name": "Compression (-c -5)", "flags": ["-c -5"]}, + # {"name": "Compression (-c -5)", "flags": ["-c -5"]}, {"name": "Compression (-c 0)", "flags": ["-c 0"]}, - {"name": "Compression (-c 10)", "flags": ["-c 10"]}, - {"name": "Compression (-c 20)", "flags": ["-c 20"]}, + # {"name": "Compression (-c 10)", "flags": ["-c 10"]}, + # {"name": "Compression (-c 20)", "flags": ["-c 20"]}, # {"name": "Chunk Serialization (-s)", "flags": ["-s"]}, {"name": "Multithreading + Compression (-m -c)", "flags": ["-m", "-c"]}, # {"name": "Multithreading + Chunk Serialization (-m -s)", "flags": ["-m", "-s"]}, From 7c02b163253ddf2adcd722a3e231c532809c252a Mon Sep 17 00:00:00 2001 From: TapTap Date: Sat, 4 Jul 2026 20:51:35 +0200 Subject: [PATCH 4/4] Revert "Merge pull request 'Fix critical issues: implement chunk_decompress and fix socket file descriptor check' (#1) from fix-critical-issues into main" This reverts commit d176507047e823f38593a231329c40e606df86fc, reversing changes made to ae4c8ff9f0f2ccbbf70b788512f04bc6d6ad83dd. --- src/shared/chunk.c | 95 +++++---------------------------------------- src/shared/socket.c | 2 +- 2 files changed, 11 insertions(+), 86 deletions(-) diff --git a/src/shared/chunk.c b/src/shared/chunk.c index 51d494f..06793ff 100644 --- a/src/shared/chunk.c +++ b/src/shared/chunk.c @@ -134,93 +134,18 @@ Data *chunk_compress(Chunk *chunk, int compression_level) { Chunk *chunk_decompress(Data *compressed_data) { log_message(LOG_LEVEL_DEBUG, "Starting to decompress chunk"); Data *uncompressed_data = data_decompress(compressed_data); - if (uncompressed_data == NULL) { - log_message(LOG_LEVEL_ERROR, "Failed to decompress chunk data"); - return NULL; - } - ArrayList *files = array_list_create(file_destroy); - char *data_pointer = uncompressed_data->data; - size_t remaining_size = uncompressed_data->size; - - while (remaining_size > 0) { - if (remaining_size < sizeof(size_t)) { - log_message(LOG_LEVEL_ERROR, "Invalid chunk format: not enough data for path length"); - array_list_destroy(files); - data_delete(uncompressed_data); - return NULL; - } - - size_t path_len = *(size_t *)data_pointer; - data_pointer += sizeof(size_t); - remaining_size -= sizeof(size_t); - - if (remaining_size < path_len) { - log_message(LOG_LEVEL_ERROR, "Invalid chunk format: not enough data for path"); - array_list_destroy(files); - data_delete(uncompressed_data); - return NULL; - } - - char *path = malloc(path_len + 1); - if (path == NULL) { - perror("Could not allocate memory for file path"); - array_list_destroy(files); - data_delete(uncompressed_data); - return NULL; - } - memcpy(path, data_pointer, path_len); - path[path_len] = '\0'; - data_pointer += path_len; - remaining_size -= path_len; - - if (remaining_size < sizeof(size_t)) { - log_message(LOG_LEVEL_ERROR, "Invalid chunk format: not enough data for data size"); - free(path); - array_list_destroy(files); - data_delete(uncompressed_data); - return NULL; - } - - size_t data_size = *(size_t *)data_pointer; - data_pointer += sizeof(size_t); - remaining_size -= sizeof(size_t); - - if (remaining_size < data_size) { - log_message(LOG_LEVEL_ERROR, "Invalid chunk format: not enough data for file content"); - free(path); - array_list_destroy(files); - data_delete(uncompressed_data); - return NULL; - } - - File *file = file_create(path, data_size); - if (file == NULL) { - free(path); - array_list_destroy(files); - data_delete(uncompressed_data); - return NULL; - } - - memcpy(file->data, data_pointer, data_size); - data_pointer += data_size; - remaining_size -= data_size; - - array_list_add(files, file); - free(path); + size_t *data_pointer = uncompressed_data->data; + while (data_pointer < + (size_t *)uncompressed_data->data + uncompressed_data->size) { + size_t path_len = data_pointer[0]; + + printf("%zu, testing", path_len); + break; } - - // Create the chunk from the files - File **file_array = (File **)array_list_to_array(files); - Chunk *chunk = chunk_create(file_array, array_list_size(files)); - - // Clean up - free(file_array); - array_list_destroy(files); - data_delete(uncompressed_data); - - log_message(LOG_LEVEL_DEBUG, "Chunk successfully decompressed"); - return chunk; + + log_message(LOG_LEVEL_DEBUG, "Chunk succesfully decompressed"); + return NULL; } Data *chunk_data_create(void *data, unsigned long long data_size) { diff --git a/src/shared/socket.c b/src/shared/socket.c index 6f81467..3494995 100644 --- a/src/shared/socket.c +++ b/src/shared/socket.c @@ -61,7 +61,7 @@ void server_listen(Server *server, void (*handler)(int file_descriptor)) { int file_descriptor = accept(server->file_descriptor, (struct sockaddr *)&server->address, &server->address_length); - if (file_descriptor < 0) { + if (server->file_descriptor < 0) { perror("Could not accept the connection"); exit(EXIT_FAILURE); }