예제 #1
0
static
void pscom_elan_do_write(pscom_con_t *con)
{
	unsigned int len;
	struct iovec iov[2];
	pscom_req_t *req;

	req = pscom_write_get_iov(con, iov);

	if (req) {
		pselan_con_info_t *ci = con->arch.elan.ci;
		len = iov[0].iov_len + iov[1].iov_len;

		int rlen = pselan_sendv(ci, iov, len);

		if (rlen >= 0) {
			pscom_write_done(con, req, rlen);
		} else if ((rlen == -EINTR) || (rlen == -EAGAIN)) {
			// Busy: Maybe out of tokens? try to read more tokens:
			_pscom_elan_do_read(con, ci);
		} else {
			// Error
			pscom_con_error(con, PSCOM_OP_WRITE, PSCOM_ERR_STDERROR);
		}
	}
}
예제 #2
0
파일: pselan.c 프로젝트: JonBau/pscom
void pselan_recvdone(pselan_con_info_t *ci)
{
	ci->n_tosend_toks++;
	ci->n_recv_toks--;
	ci->recv_pos = (ci->recv_pos + 1) % SIZE_SR_QUEUE;

	if (ci->n_tosend_toks >= MAX_PENDING_TOKS) {
		//while (pselan_sendv(con_info, NULL, 0) == -EAGAIN);
		pselan_sendv(ci, NULL, 0);
	}
}