Commit Diff


commit - 43c08a530e595df40d8133b9a3f77318c2a04b44
commit + 52939b686ae906897e9b7956b61d15c255539e6d
blob - 36ce2515faf1ac5c49de622315565ce78955f76b
blob + 00d1d81a42f9598ad0cba57a03f07fb868556714
--- gotd/gotd.c
+++ gotd/gotd.c
@@ -338,13 +338,8 @@ disconnect(struct gotd_client *client)
 	kill_auth_proc(client);
 	kill_session_proc(client);
 
-	idisconnect.client_id = client->id;
 	if (proc) {
-		if (gotd_imsg_compose_event(&proc->iev,
-		    GOTD_IMSG_DISCONNECT, PROC_GOTD, -1,
-		    &idisconnect, sizeof(idisconnect)) == -1)
-			log_warn("imsg compose DISCONNECT");
-
+		event_del(&proc->iev.ev);
 		msgbuf_clear(&proc->iev.ibuf.w);
 		close(proc->iev.ibuf.fd);
 		kill_proc(proc, 0);
@@ -353,6 +348,7 @@ disconnect(struct gotd_client *client)
 		proc = NULL;
 	}
 
+	idisconnect.client_id = client->id;
 	if (gotd_imsg_compose_event(&listen_proc->iev,
 	    GOTD_IMSG_DISCONNECT, PROC_GOTD, -1,
 	    &idisconnect, sizeof(idisconnect)) == -1)