예제 #1
0
파일: ipcc.c 프로젝트: kgaillot/libqb
ssize_t
qb_ipcc_recv(struct qb_ipcc_connection * c, void *msg_ptr,
	     size_t msg_len, int32_t ms_timeout)
{
	int32_t res = 0;
	int32_t connect_res = 0;

	if (c == NULL) {
		return -EINVAL;
	}

	res = c->funcs.recv(&c->response, msg_ptr, msg_len, ms_timeout);
	if (res >= 0) {
		return res;
	}

	/* if we didn't get a msg, check connection state */
	connect_res = _check_connection_state_with(c, res,
					    _response_sock_one_way_get(c),
					    ms_timeout, POLLIN);

	/* only report the connection state check result if an error is returned. */
	if (connect_res < 0) {
		return connect_res;
	}
	return res;
}
예제 #2
0
파일: ipcc.c 프로젝트: krig/libqb
int32_t
qb_ipcc_is_connected(qb_ipcc_connection_t *c)
{
	struct qb_ipc_one_way *ow;

	if (c == NULL) {
		return QB_FALSE;
	}

	ow = _response_sock_one_way_get(c);
	(void)_check_connection_state_with(c, -EAGAIN, ow, 0, POLLIN);

	return c->is_connected;
}
예제 #3
0
파일: ipcc.c 프로젝트: krig/libqb
ssize_t
qb_ipcc_recv(struct qb_ipcc_connection * c, void *msg_ptr,
	     size_t msg_len, int32_t ms_timeout)
{
	int32_t res = 0;

	if (c == NULL) {
		return -EINVAL;
	}

	res = c->funcs.recv(&c->response, msg_ptr, msg_len, ms_timeout);
	return _check_connection_state_with(c, res,
					    _response_sock_one_way_get(c),
					    ms_timeout, POLLIN);
}
예제 #4
0
파일: ipcc.c 프로젝트: ip1981/libqb
int32_t
qb_ipcc_is_connected(qb_ipcc_connection_t *c)
{
	struct qb_ipc_one_way *ow;

	if (c == NULL) {
		return QB_FALSE;
	}

	ow = _response_sock_one_way_get(c);
	if (ow) {
		_check_connection_state(c, qb_ipc_us_recv_ready(ow, 0));
	}

	return c->is_connected;
}
예제 #5
0
파일: ipcc.c 프로젝트: ip1981/libqb
ssize_t
qb_ipcc_recv(struct qb_ipcc_connection * c, void *msg_ptr,
	     size_t msg_len, int32_t ms_timeout)
{
	int32_t res = 0;
	int32_t res2 = 0;
	if (c == NULL) {
		return -EINVAL;
	}

	res = c->funcs.recv(&c->response, msg_ptr, msg_len, ms_timeout);
	if (res == -EAGAIN || res == -ETIMEDOUT) {
		struct qb_ipc_one_way *ow = _response_sock_one_way_get(c);

		if (ow == NULL) return res;

		res2 = qb_ipc_us_recv_ready(ow, 0);
		if (res2 < 0) {
			res = res2;
		}
	}
	_check_connection_state(c, res);
	return res;
}