Honor the expected file version before downloading

This commit is contained in:
evgeny committed 2026-10-10 01:35:28 +02:00
1 parent 468aeeebc7
commit ac17ffda54
2 files changed
+9 -1

No files matched your search

+8
View File
@@ -92,6 +92,7 @@ static void api_start(struct network_test* t, unsigned index, int node, int uplo
.server = t->ids[SERVER], .owner = t->ids[upload ? node : AUTHOR], .upload = upload };
snprintf(q.remote, sizeof(q.remote), "%s", remote);
snprintf(q.local, sizeof(q.local), "%s", upload ? source : c->local);
if (!upload && source) memcpy(q.version, source, 16);
c->handle = member_files_transfer_start(&q, api_event, c);
if (!c->handle) fail(t, "parallel API start");
}
@@ -262,6 +263,13 @@ static void tick(void* arg) {
if (!t->api[0].finished || !t->api[1].finished || !t->api[7].finished) goto again;
if (t->api[0].status || t->api[1].status || t->api[7].status || !check_file(t->api[0].local, BYTES) ||
!check_file(t->api[1].local, BYTES) || !check_file(t->api[7].local, 0)) { fail(t, "parallel/empty download bytes"); return; }
t->phase = 22;
uint8_t stale[16]; memset(stale, 0xa5, sizeof(stale));
api_start(t, 7, READER, 0, "file.bin", (const char*)stale);
} else if (t->phase == 22 && t->api[7].finished) {
if (t->api[7].status != MF_STALE || !check_file(t->api[7].local, 0)) {
fail(t, "stale download changed existing destination"); return;
}
t->phase = 10; t->answered = 0;
struct mf_message q = { .command = MF_STAT, .owner = t->ids[AUTHOR] }; snprintf(q.path, sizeof(q.path), "cancelled.bin");
if (!member_files_request(t->nodes[READER], GROUP, t->ids[SERVER], &q, response, t)) { fail(t, "cancelled STAT"); return; }