Fix two bugs in read operation that caused test failure

1. Fix client not reading all server addresses in READ response
   The metadata server sends address info for ALL chunk servers holding
   a chunk, but the client only read info for ONE server. This caused
   message parsing to become misaligned for subsequent chunks.

   Added a loop to iterate through all num_servers and read each
   server's address list (using the first one, skipping the rest).

2. Fix tag value conflict between metadata and chunk server responses
   TAG_RETRIEVE_METADATA_FOR_READ was 1, which conflicted with chunk
   download range indices (0, 1, 2, 3...). When the second chunk
   download response came with range_idx=1, it was incorrectly treated
   as a metadata response.

   Changed TAG values from positive to negative integers since range
   indices are always non-negative.

Also updated the test to properly exit on success instead of assert(0).

https://claude.ai/code/session_01QYDQCNiUj1cjrsS6qRgkvd
This commit is contained in:
Claude
2026-01-27 22:15:20 +00:00
parent 3bb30dcd09
commit cd3ecec786
2 changed files with 39 additions and 37 deletions
+2 -2
View File
@@ -166,8 +166,8 @@ int test_client_tick(void *state_, void **ctxs,
if (memcmp(client->buf, msg, sizeof(msg)-1)) {
assert(0); // TODO
}
assert(0); // TODO
break;
printf("Test PASSED: Read data matches written data\n");
exit(0); // Test completed successfully
}
*timeout = -1;