Beispiel #1
0
static
int send_all(psdapl_con_info_t *ci, char *buf, unsigned count)
{
	int len;
	int c = count;

	while (c > 0) {
		struct iovec iov;
		iov.iov_base = buf;
		iov.iov_len = c;
		len = psdapl_sendv(ci, &iov, c);
		if (len < 0) {
			if (len == -EAGAIN) {
				idle();
				continue;
			} else {
				printf("sendv returned error: %s\n", strerror(-len));
				exit(-1);
			}
		}
		c -= len;
		buf += len;
	}

	return count;
}
Beispiel #2
0
static inline
void _psdapl_send_tokens(psdapl_con_info_t *ci)
{
	if (ci->n_tosend_toks >= MAX_PENDING_TOKS) {
		if (psdapl_sendv(ci, NULL, 0) == -EAGAIN) {
			psdapl_stat.busy_token_refresh++;
		}
	}
}