diff --git a/fastsync_server b/fastsync_server index 84edbcb..9bac353 100755 Binary files a/fastsync_server and b/fastsync_server differ diff --git a/src/server.c b/src/server.c index 7fb59db..9f3feb3 100644 --- a/src/server.c +++ b/src/server.c @@ -303,19 +303,15 @@ void handle_client(int sock_fd, const char *dest_dir) { if (magic == MAGIC_BATCH_META) { // Handle batch metadata - // We already read the magic, now read the rest of the header + // We already read the magic (4 bytes), now read the rest of the header (16 bytes) batch_meta_header_t batch_hdr; - uint32_t rest_of_header[3]; // count, total_name_len, total_size_hi - uint32_t total_size_lo; - if (readn(sock_fd, &rest_of_header, sizeof(rest_of_header)) != sizeof(rest_of_header) || - readn(sock_fd, &total_size_lo, sizeof(total_size_lo)) != sizeof(total_size_lo)) { + batch_hdr.magic = magic; + if (readn(sock_fd, &batch_hdr.count, sizeof(batch_hdr.count)) != sizeof(batch_hdr.count) || + readn(sock_fd, &batch_hdr.total_name_len, sizeof(batch_hdr.total_name_len)) != sizeof(batch_hdr.total_name_len) || + readn(sock_fd, &batch_hdr.total_size, sizeof(batch_hdr.total_size)) != sizeof(batch_hdr.total_size)) { fprintf(stderr, "Failed to read batch header\n"); break; } - batch_hdr.magic = magic; - batch_hdr.count = rest_of_header[0]; - batch_hdr.total_name_len = rest_of_header[1]; - batch_hdr.total_size = ((uint64_t)rest_of_header[2] << 32) | total_size_lo; if (batch_hdr.count > BATCH_MAX_FILES) { fprintf(stderr, "Batch count %u exceeds max %d\n", batch_hdr.count, BATCH_MAX_FILES); diff --git a/src/server.o b/src/server.o index c43cbf1..e52e03e 100644 Binary files a/src/server.o and b/src/server.o differ