commit ba91039c1a0a3d55f4850e26c24730cbf4b5c239 from: Omar Polo date: Thu Jun 22 15:30:28 2023 UTC add kill_repo_proc() similarly to the other kill_*_proc() ok stsp@ commit - f25e229e88a01c4a65fa80f4d5e35cd34309cbf9 commit + ba91039c1a0a3d55f4850e26c24730cbf4b5c239 blob - 84ef3291493887b755234fd478a3f7a7ca500d19 blob + 39b1d2a54632934de2bfaf127e20f0b0f725f4c8 --- gotd/gotd.c +++ gotd/gotd.c @@ -308,6 +308,20 @@ proc_done(struct gotd_child_proc *proc) } static void +kill_repo_proc(struct gotd_client *client) +{ + struct gotd_child_proc *proc; + + if (client->repo == NULL) + return; + + proc = client->repo; + client->repo = NULL; + + proc_done(proc); +} + +static void kill_auth_proc(struct gotd_client *client) { struct gotd_child_proc *proc; @@ -339,7 +353,6 @@ static void disconnect(struct gotd_client *client) { struct gotd_imsg_disconnect idisconnect; - struct gotd_child_proc *proc = client->repo; struct gotd_child_proc *listen_proc = gotd.listen_proc; uint64_t slot; @@ -347,17 +360,8 @@ disconnect(struct gotd_client *client) kill_auth_proc(client); kill_session_proc(client); + kill_repo_proc(client); - if (proc) { - event_del(&proc->iev.ev); - msgbuf_clear(&proc->iev.ibuf.w); - close(proc->iev.ibuf.fd); - kill_proc(proc, 0); - wait_for_child(proc->pid); - free(proc); - proc = NULL; - } - idisconnect.client_id = client->id; if (gotd_imsg_compose_event(&listen_proc->iev, GOTD_IMSG_DISCONNECT, PROC_GOTD, -1,