Skip to content
Snippets Groups Projects
Commit 059c836e authored by ChouTatsumi's avatar ChouTatsumi
Browse files

restart error print test

parent 5139f9e3
No related branches found
No related tags found
No related merge requests found
......@@ -201,11 +201,13 @@ static bool handle_http_request(int sockfd) {
}
// players setting and detecting
if (p1_sockfd < 0 && sockfd != p2_sockfd)
if (p1_sockfd < 0 && sockfd != p2_sockfd) {
printf("p1 sockfd is set to %d.\r\n", sockfd);
p1_sockfd = sockfd;
else if (p2_sockfd < 0 && sockfd != p1_sockfd)
} else if (p2_sockfd < 0 && sockfd != p1_sockfd) {
printf("p2 sockfd is set to %d.\r\n", sockfd);
p2_sockfd = sockfd;
else if (sockfd != p1_sockfd && sockfd != p2_sockfd) {
} else if (sockfd != p1_sockfd && sockfd != p2_sockfd) {
perror("more than 2 players");
exit(EXIT_FAILURE);
}
......@@ -253,11 +255,13 @@ static bool handle_http_request(int sockfd) {
} else if (*curr == '?') {
if (method == GET) {
// flag ready for players
if (sockfd == p1_sockfd)
if (sockfd == p1_sockfd) {
printf("p1 is ready.\r\n");
p1_is_ready = true;
else if (sockfd == p2_sockfd)
} else if (sockfd == p2_sockfd) {
printf("p2 is ready.\r\n");
p2_is_ready = true;
else {
} else {
perror("more than 2 players");
exit(EXIT_FAILURE);
}
......@@ -416,6 +420,7 @@ bool keyword_check(int sockfd, char* keyword) {
}
void player_init() {
printf("Player init.\r\n");
p1_is_ready = p2_is_ready = false;
p1_sockfd = p2_sockfd = -1;
p1_guess_len = p2_guess_len = 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment