commit - fa94c02250118210d63c5161d74c7783e009edcb
commit + 1ca965ba4c9a64871f00758c02f279d158cd6820
blob - 740edfb7ecbcb748c9f113112c47194c0b2ec07a
blob + c80ad832621e5ed43a6e3ba784c8db0b99ff1ce4
--- gotd/gotd.c
+++ gotd/gotd.c
proc_done(struct gotd_child_proc *proc)
{
struct gotd_client *client;
+ int do_disconnect = 0;
TAILQ_REMOVE(&procs, proc, entry);
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;
}
}
free(proc);
+
+ if (do_disconnect)
+ disconnect(client);
}
static void