Esempio n. 1
0
/**
 * Convert a socket to an endpoint.
 */
static void
endpoint_from_sock_cfg(const cf_sock_cfg* src, as_endpoint* endpoint)
{
	endpoint->addr_type =
		cf_ip_addr_is_legacy(&src->addr) ? AS_ENDPOINT_ADDR_TYPE_IPv4 : AS_ENDPOINT_ADDR_TYPE_IPv6;
	endpoint->port = src->port;

	// We will have allocated correct binary size.
	CF_IGNORE_ERROR(
		cf_ip_addr_to_binary(&src->addr, endpoint->addr,
			endpoint_addr_binary_size(endpoint->addr_type)));

	endpoint->capabilities = (src->owner == CF_SOCK_OWNER_HEARTBEAT_TLS ||
		src->owner == CF_SOCK_OWNER_FABRIC_TLS) ? AS_ENDPOINT_TLS_MASK : 0;
}
void
thr_demarshal_resume(as_file_handle *fd_h)
{
	fd_h->trans_active = false;

	// Make the demarshal thread aware of pending connection data (if any).
	// Writing to an FD's event mask makes the epoll instance re-check for
	// data, even when edge-triggered. If there is data, the demarshal thread
	// gets EPOLLIN for this FD.

	// This causes ENOENT, when we reached NextEvent_FD_Cleanup (e.g, because
	// the client disconnected) while the transaction was still ongoing.

	static int32_t err_ok[] = { ENOENT };
	CF_IGNORE_ERROR(cf_poll_modify_socket_forgiving(fd_h->poll, fd_h->sock,
			EPOLLIN | EPOLLET | EPOLLRDHUP, fd_h,
			sizeof(err_ok) / sizeof(int32_t), err_ok));
}