Add signal queue to Quakey
This commit is contained in:
@@ -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
@@ -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
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user