if (p->pipe_params.state == 2) pollfds[p->rpollindex].events |= POLLIN; }
static int writetoclient(struct connection *p){	size_t bytestowrite;	ssize_t r;	bytestowrite = p->output.end - p->output.start;	if (bytestowrite == 0) {		log_d("writetoclient: bytestowrite is zero!");		return 0;	}	r = send(p->fd, p->output.start, bytestowrite, 0);	if (debug)		log_d("writetoclient: %d %d %d %d", p->fd, p->output.start - p->output.floor, bytestowrite, r);	switch (r) {	case -1:		switch (errno) {		case EAGAIN:			return 0;		default:			lerror("writetoclient");		case EPIPE:		case ECONNRESET:			close_connection(p);			return -1;		}		break;	default:		p->t = current_time;		p->nwritten += r;		p->output.start += r;		if (p->output.start == p->output.end)			p->output.start = p->output.end = p->output.floor;		break;	}	return 0;}