commit 1ca965ba4c9a64871f00758c02f279d158cd6820 from: Stefan Sperling via: Thomas Adam date: Fri Mar 21 13:22:46 2025 UTC keep disconnecting gotd clients when important child processes exit This should fix a regression introduced in commit dda4473541d84973dd43a16f2f79ff0ce5f93dfe (make gotd run 'gotsys check' on gotsys.conf commits before accepting them), where I removed a call to the disconnect() function in proc_done(). We have now observed stale client sessions accumulating on got.gameoftrees.org, blocking new connections from anonymous users. This commit fixes the most likely reason for that issue. commit - fa94c02250118210d63c5161d74c7783e009edcb commit + 1ca965ba4c9a64871f00758c02f279d158cd6820 blob - 740edfb7ecbcb748c9f113112c47194c0b2ec07a blob + c80ad832621e5ed43a6e3ba784c8db0b99ff1ce4 --- gotd/gotd.c +++ gotd/gotd.c @@ -314,6 +314,7 @@ static void proc_done(struct gotd_child_proc *proc) { struct gotd_client *client; + int do_disconnect = 0; TAILQ_REMOVE(&procs, proc, entry); @@ -321,12 +322,18 @@ proc_done(struct gotd_child_proc *proc) if (client == NULL) client = find_client_by_proc_fd(proc->pipe[0]); if (client != NULL) { - if (proc == client->repo) + if (proc == client->repo) { client->repo = NULL; - if (proc == client->auth) + do_disconnect = 1; + } + if (proc == client->auth) { client->auth = NULL; - if (proc == client->session) + do_disconnect = 1; + } + if (proc == client->session) { client->session = NULL; + do_disconnect = 1; + } if (proc == client->gotsys) client->gotsys = NULL; } @@ -343,6 +350,9 @@ proc_done(struct gotd_child_proc *proc) } free(proc); + + if (do_disconnect) + disconnect(client); } static void