Add signal queue to Quakey

This commit is contained in:
2026-01-28 20:57:33 +01:00
parent da3223a725
commit 1d6b11bcc3
5 changed files with 80 additions and 4 deletions
-1
View File
@@ -29,7 +29,6 @@ static string hash2path(ChunkServer *state, SHA256 hash, char *out)
return (string) { out, strlen(out) };
}
// TODO: return an error when bitrot
static int load_chunk(ChunkServer *state, SHA256 hash, string *data)
{
char buf[PATH_MAX];
+10 -1
View File
@@ -334,9 +334,18 @@ int main(void)
quakey_spawn(quakey, config, "cs --addr 127.0.0.6 --port 8083 --remote-addr 127.0.0.3 --remote-port 8080");
}
while (simulation_running)
while (simulation_running) {
quakey_schedule_one(quakey);
QuakeySignal signal;
while (quakey_get_signal(quakey, &signal)) {
if (!strcmp(signal.name, "exit"))
simulation_running = false;
}
}
quakey_free(quakey);
return 0;
}
+1 -1
View File
@@ -619,7 +619,7 @@ int test_client_tick(void *state_, void **ctxs,
printf("\n========================================\n");
printf("All %d tests PASSED!\n", client->tests_passed);
printf("========================================\n");
exit(0);
QUAKEY_SIGNAL("exit");
}
*timeout = -1;