if (p->cn == 0) { log_d("cleaning up orphan pipe"); close_child(p, -1); } else { if (p->error_condition) { if (p->error_condition == STUB_ERROR_RESTART) close_child(p, cgi_error(p->cn->r) == -1 ? HC_CLOSING : HC_WRITING); else close_child(p, HC_CLOSING); } else if (current_time >= p->t + (time_t) tuning.script_timeout) { log_d("script timeout to %s[%hu]", inet_ntoa(p->cn->peer.sin_addr), ntohs(p->cn->peer.sin_port)); close_child(p, HC_CLOSING); } else if (childisfinished(p)) close_child(p, p->cn->keepalive ? HC_REINIT : HC_CLOSING);
if (p->pipe_params.error_condition) { if (p->pipe_params.error_condition == STUB_ERROR_RESTART && cgi_error(p->r) != -1) set_connection_state(p, HC_WRITING); else close_connection(p); } else if (current_time >= p->t + (time_t) tuning.script_timeout) { log_d("script timeout to %s[%hu]", inet_ntoa(p->peer.sin_addr), ntohs(p->peer.sin_port)); close_connection(p); } else if (childisfinished(p)) { if (p->keepalive) reinit_connection(p); else close_connection(p);
void cleanup_children(void){	struct pipe_params *p, *n;	p = busy_pipes.head;	while (p) {		n = p->next;		if (p->cn == 0) {			log_d("cleaning up orphan pipe");			close_child(p, -1);		} else {			if (p->error_condition) {				if (p->error_condition == STUB_ERROR_RESTART)					close_child(p, cgi_error(p->cn->r) == -1 ? HC_CLOSING : HC_WRITING);				else					close_child(p, HC_CLOSING);			} else if (current_time >= p->t + (time_t) tuning.script_timeout) {				log_d("script timeout to %s[%hu]", inet_ntoa(p->cn->peer.sin_addr), ntohs(p->cn->peer.sin_port));				close_child(p, HC_CLOSING);			} else if (childisfinished(p))				close_child(p, p->cn->keepalive ? HC_REINIT : HC_CLOSING);		}		p = n;	}}