aboutsummaryrefslogtreecommitdiff
path: root/seatd/server.c
diff options
context:
space:
mode:
Diffstat (limited to 'seatd/server.c')
-rw-r--r--seatd/server.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/seatd/server.c b/seatd/server.c
index 9a71d66..1da8041 100644
--- a/seatd/server.c
+++ b/seatd/server.c
@@ -26,6 +26,7 @@ int server_init(struct server *server) {
poller_init(&server->poller);
linked_list_init(&server->seats);
+ linked_list_init(&server->idle_clients);
if (poller_add_signal(&server->poller, SIGUSR1, server_handle_vt_rel, server) == NULL ||
poller_add_signal(&server->poller, SIGUSR2, server_handle_vt_acq, server) == NULL ||
@@ -51,6 +52,11 @@ int server_init(struct server *server) {
void server_finish(struct server *server) {
assert(server);
+ while (!linked_list_empty(&server->idle_clients)) {
+ struct client *client = (struct client *)server->idle_clients.next;
+ linked_list_remove(&client->link);
+ client_destroy(client);
+ }
while (!linked_list_empty(&server->seats)) {
struct seat *seat = (struct seat *)server->seats.next;
linked_list_remove(&seat->link);
@@ -131,6 +137,7 @@ int server_add_client(struct server *server, int fd) {
}
log_infof("new client connected (pid: %d, uid: %d, gid: %d)", client->pid, client->uid,
client->gid);
+ linked_list_insert(&server->idle_clients, &client->link);
return 0;
}