il server non chiude piu
This commit is contained in:
parent
5234d5f542
commit
751dda12b7
4
TODO.txt
4
TODO.txt
|
@ -6,4 +6,6 @@
|
|||
|
||||
- messaggio speciale per abbandono
|
||||
|
||||
- se le ipcs non si sono chiuse bene non funzia
|
||||
- se le ipcs non si sono chiuse bene non funzia
|
||||
|
||||
- fa errore quando un giocatore abbandona
|
|
@ -35,10 +35,12 @@ void sigHandlerServer(int sig) {
|
|||
signal(SIGINT, sigIntHandler2);
|
||||
}
|
||||
|
||||
// abbandono di un giocatore
|
||||
if (sig == SIGUSR1) {
|
||||
// il giocatore che abbandona mi manda gia il messaggio dicendo che ha vinto l'altro
|
||||
game_end_t game;
|
||||
rcvGame_end(&game);
|
||||
printf("vince %d\n", game.winner);
|
||||
|
||||
sndGame_end(&game);
|
||||
sndGame_end(&game);
|
||||
|
@ -46,7 +48,9 @@ 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);
|
||||
|
||||
_PIDS[0] = 0;
|
||||
printf("adesso vi chiudo\n");
|
||||
|
||||
_PIDS[0] = 0; // FIXME: cosi non li prova a richiudere dopo
|
||||
_PIDS[1] = 0;
|
||||
|
||||
sig = SIGTERM;
|
||||
|
@ -129,6 +133,7 @@ void sigHandlerClient(int sig) {
|
|||
printf(PCLIENT "Quitting game\n");
|
||||
game_end_t game = {.mtype = GAME_END, .winner = ID ^ 1};
|
||||
sndGame_end(&game);
|
||||
printf("server pid: %d\n", SERVER_PID);
|
||||
kill(SERVER_PID, SIGUSR1);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue