Phase 1+2: bug fixes and dead code cleanup
Phase 1 — Bugs: - receive_data: fix unsigned long long vs size_t mismatch - chunk_deserialize: add NULL check in multiprocessing.c and server.c - file_content_to_buffer: add missing fclose on error path - send_files_multithreaded: propagate sender thread result - server: add SIGPIPE handler - to_disk: check fwrite return value - scanner: use S_ISDIR instead of !S_ISREG - scanner: free cur_path before early return Phase 2 — Cleanup: - Remove unused chunk_decompress function - Remove unused array_list_clear function - Remove unused num_connections config field - Remove duplicate FILE_METADATA_WIRE_SIZE macro - Update tests for removed APIs
This commit is contained in:
+6
-7
@@ -8,7 +8,7 @@
|
||||
|
||||
static void test_config_lifecycle() {
|
||||
Config *cfg = config_create(str_dup("1.0"), str_dup("/src"), str_dup("/dst"),
|
||||
true, true, false, false, false, 1, 4, false);
|
||||
true, true, false, false, false, 1, false);
|
||||
EXPECT_NOT_NULL(cfg);
|
||||
EXPECT_EQ_STR(cfg->version, "1.0");
|
||||
EXPECT_EQ_STR(cfg->send_directory, "/src");
|
||||
@@ -17,7 +17,6 @@ static void test_config_lifecycle() {
|
||||
EXPECT_TRUE(cfg->use_multithreading);
|
||||
EXPECT_FALSE(cfg->use_chunk_serialization);
|
||||
EXPECT_FALSE(cfg->use_compression);
|
||||
EXPECT_EQ_INT(cfg->num_connections, 4);
|
||||
EXPECT_EQ_INT(cfg->transport, TRANSPORT_TCP);
|
||||
EXPECT_NULL(cfg->ssh_destination);
|
||||
config_delete(cfg);
|
||||
@@ -25,7 +24,7 @@ static void test_config_lifecycle() {
|
||||
|
||||
static void test_config_ssh_dest() {
|
||||
Config *cfg = config_create(str_dup("1.0"), str_dup("/src"), str_dup("user@host:/dst"),
|
||||
true, false, false, false, false, 1, 4, false);
|
||||
true, false, false, false, false, 1, false);
|
||||
EXPECT_NOT_NULL(cfg);
|
||||
EXPECT_EQ_INT(cfg->transport, TRANSPORT_TCP);
|
||||
EXPECT_NULL(cfg->ssh_destination);
|
||||
@@ -40,7 +39,7 @@ static void test_config_ssh_dest() {
|
||||
|
||||
static void test_config_ssh_dest_local_path() {
|
||||
Config *cfg = config_create(str_dup("1.0"), str_dup("/src"), str_dup("/local/path"),
|
||||
true, false, false, false, false, 1, 4, false);
|
||||
true, false, false, false, false, 1, false);
|
||||
config_parse_ssh_dest(cfg);
|
||||
EXPECT_EQ_INT(cfg->transport, TRANSPORT_TCP);
|
||||
EXPECT_NULL(cfg->ssh_destination);
|
||||
@@ -50,7 +49,7 @@ static void test_config_ssh_dest_local_path() {
|
||||
|
||||
static void test_config_ssh_dest_no_user() {
|
||||
Config *cfg = config_create(str_dup("1.0"), str_dup("/src"), str_dup("host:/remote"),
|
||||
true, false, false, false, false, 1, 4, false);
|
||||
true, false, false, false, false, 1, false);
|
||||
config_parse_ssh_dest(cfg);
|
||||
EXPECT_EQ_INT(cfg->transport, TRANSPORT_SSH);
|
||||
EXPECT_EQ_STR(cfg->ssh_destination, "host:/remote");
|
||||
@@ -60,7 +59,7 @@ static void test_config_ssh_dest_no_user() {
|
||||
|
||||
static void test_pipeline_sender_lifecycle() {
|
||||
Config *cfg = config_create(str_dup("2.0"), str_dup("/src2"),
|
||||
str_dup("/dst2"), false, false, true, true, false, 1, 8, false);
|
||||
str_dup("/dst2"), false, false, true, true, false, 1, false);
|
||||
Queue *q1 = queue_create(5, NULL);
|
||||
Queue *q2 = queue_create(15, NULL);
|
||||
|
||||
@@ -77,7 +76,7 @@ static void test_pipeline_sender_lifecycle() {
|
||||
|
||||
static void test_pipeline_receiver_lifecycle() {
|
||||
Config *cfg = config_create(str_dup("3.0"), str_dup("/src3"),
|
||||
str_dup("/dst3"), true, true, true, true, false, 1, 2, false);
|
||||
str_dup("/dst3"), true, true, true, true, false, 1, false);
|
||||
Queue *q = queue_create(20, NULL);
|
||||
|
||||
PipelineContextReceiver *pcr = pipeline_context_receiver_create(cfg, q, 42);
|
||||
|
||||
Reference in New Issue
Block a user