rifunziona pt 30000

This commit is contained in:
Lorenzo Bianchi 2023-06-01 15:03:34 +02:00
parent c051085e4a
commit c744bb47b4
3 changed files with 13 additions and 8 deletions

View File

@ -1,9 +1,9 @@
- sistemare include (FARE SOLO ALLA FINE ALTRIMENTI SPRECO DI TEMPO COME LA TUA VITA)
- abbandono player
- ho scoperto solo adesso che c'é set_rows ecc, forse non lho sempre usato facendo invece _ROWS = ...
- messaggio speciale per abbandono
- se le ipcs non si sono chiuse bene non funzia
- se le ipcs non si sono chiuse bene non funzia
- controllare pareggi

View File

@ -48,6 +48,10 @@ void sigHandlerServer(int sig) {
kill(_PIDS[0], SIGUSR1); //FIXME: fare una funzione per queste robe perche anche gia scritta a fine F4Server
kill(_PIDS[1], SIGUSR1);
// aspetto terminazione dei due figli
semOp(_SEMID, 0, -1);
semOp(_SEMID, 1, -1);
raise(SIGTERM);
}
@ -131,7 +135,6 @@ void sigHandlerClient(int sig) {
sndGame_end(&game);
printf("server pid: %d\n", SERVER_PID);
kill(SERVER_PID, SIGUSR1);
}
// Terminazione e chiusura terminale
@ -156,12 +159,14 @@ void sigHandlerClient(int sig) {
printBoard();
if (winner.winner == ID) {
printf("YOU WON!!!\n");
printf(PSERVER "YOU WIN!!!\n");
} else if (winner.winner == -1) {
printf("YOU LOST!!!\n");
printf(PSERVER "DRAW!!!\n");
} else {
printf(PSERVER "YOU LOSE!!!\n");
}
raise(SIGTERM);
semOp(_SEMID, ID, 1);
}
}

View File

@ -67,7 +67,7 @@ input_server_t checkServerInput(int argc, char *argv[]){
.player2Token = argv[4][0]
};
if (input.collums<5 || input.rows<5) {
if (input.collums < 5 || input.rows < 5) {
errExitMsg("To few rows or collums");
}