log_d("writetoclient: fd=%d, obp=%d, bytestowrite=%d, r=%d", p->cfd, p->obp, bytestowrite, r);
log_d("writetoclient: %d %d %d %d", p->cfd, p->obp, bytestowrite, r);
static int writetoclient(struct pipe_params *p){	size_t bytestowrite;	ssize_t r;	bytestowrite = p->otop - p->obp;	if (bytestowrite == 0) {		log_d("writetoclient: bytestowrite is zero!");		return 0;	}	r = send(p->cfd, p->obuf + p->obp, bytestowrite, 0);	if (debug)		log_d("writetoclient: fd=%d, obp=%d, bytestowrite=%d, r=%d", p->cfd, p->obp, bytestowrite, r);	switch (r) {	case -1:		switch (errno) {		case EAGAIN:			return 0;		default:			lerror("writetoclient");		case EPIPE:		case ECONNRESET:			p->error_condition = STUB_ERROR_CLIENT;			return -1;		}		break;	default:		p->t = current_time;		p->cn->nwritten += r;		p->obp += r;		if (p->obp == p->otop)			p->obp = p->otop = 0;		break;	}	return 0;}