Disconnect clients after server loop
This commit is contained in:
parent
39fde32fd6
commit
7e4a8bc707
1 changed files with 6 additions and 0 deletions
|
@ -129,6 +129,12 @@ int main(int argc, char *argv[]) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Disconnect all clients before closing the server */
|
||||||
|
for (int i = 0; i < MAX_CLIENTS; i++) {
|
||||||
|
write(clients[i].sockid, "disconnect command", 0); // TODO: decide a disconnect command to send
|
||||||
|
disconnect_client(i);
|
||||||
|
}
|
||||||
|
|
||||||
printf("Server end, closing connection\n");
|
printf("Server end, closing connection\n");
|
||||||
(void) pthread_join(dispatcher, &retval);
|
(void) pthread_join(dispatcher, &retval);
|
||||||
close(serv_sockid);
|
close(serv_sockid);
|
||||||
|
|
Loading…
Reference in a new issue