aboutsummaryrefslogtreecommitdiff
path: root/seatd/client.c
diff options
context:
space:
mode:
authorKenny Levinsen <kl@kl.wtf>2022-03-03 14:43:13 +0100
committerKenny Levinsen <kl@kl.wtf>2022-03-03 14:44:56 +0100
commit795cf169e779aa003a5f4e990d7c9d307132d570 (patch)
tree9f34300045e224d650c811ff221d08621dec6ed8 /seatd/client.c
parent46c83972fe66b917032a832bb8e3309ac6783d7d (diff)
seatd: Shut down on client disconnect in builtin
If we're part of the libseat builtin backend, then we only have one client. Shut down the server when this client disconnects.
Diffstat (limited to 'seatd/client.c')
-rw-r--r--seatd/client.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/seatd/client.c b/seatd/client.c
index 220c5d3..6b6f3b3 100644
--- a/seatd/client.c
+++ b/seatd/client.c
@@ -81,6 +81,13 @@ struct client *client_create(struct server *server, int client_fd) {
void client_destroy(struct client *client) {
assert(client);
+
+#ifdef LIBSEAT
+ // The built-in backend version of seatd should terminate once its only
+ // client disconnects.
+ client->server->running = false;
+#endif
+
client->server = NULL;
if (client->connection.fd != -1) {
close(client->connection.fd);