diff options
Diffstat (limited to 'src/chess.c')
| -rw-r--r-- | src/chess.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/chess.c b/src/chess.c index adb5ce2..5e52482 100644 --- a/src/chess.c +++ b/src/chess.c @@ -44,7 +44,7 @@ int main(int argc, char **argv) { isHost = 1; /* we are acting as the host--await a connection */ printf("Awaiting connection\n"); - match = await_match(matchFile, NULL); + match = await_match(matchFile, init_cancel_token_never()); printf("Connection completed. Match is %s\n", match.uuid); } else { @@ -52,11 +52,12 @@ int main(int argc, char **argv) { /* we are joining an existing match */ printf("Attempting to join existing match\n"); match = join_match(); - if (match.uuid != NULL) { + if (strlen(match.uuid) == 36) { printf("Joined match %s\n", match.uuid); } else { - printf("Error joining match. reload the program\n"); + printf("Error joining match. Reload the program\n"); + exit(1); } } sleep(2); @@ -71,7 +72,7 @@ int main(int argc, char **argv) { /* awaiting the remote player */ printf("Waiting for %s's move\n", turn ? "black" : "white"); while (1) { - char* message = read_message(match, NULL); + char* message = read_message(match, init_cancel_token_never()); /* try to parse the message as a move */ if (strncmp(message, "move=", 5) == 0) { vector_t rOrigin = init_vector(message[5] - '0', message[6] - '0'); |
