Disconnect clients after server loop

This commit is contained in:
Tunui Franken 2022-10-25 08:51:19 +02:00
parent 39fde32fd6
commit 7e4a8bc707

View file

@ -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");
(void) pthread_join(dispatcher, &retval);
close(serv_sockid);