uint64_t ncrx_invoke_process_at()

in ncrx/libncrx.c [730:753]


uint64_t ncrx_invoke_process_at(struct ncrx *ncrx)
{
	uint64_t when = UINT64_MAX;
	struct ncrx_msg *msg;

	/* ack enabled and pending? */
	if (ncrx->p.ack_intv && ncrx->head_seq &&
			ncrx->acked_seq != tail_seq(ncrx) - 1)
		when = min(when, ncrx->acked_at + ncrx->p.ack_intv);

	/*
	 * Holes to request for retransmission?  msg_timeout is the same
	 * condition but way longer.  Checking on retx_intv is enough.
	 */
	if (!list_empty(&ncrx->hole_list))
		when = min(when, ncrx->now_mono + ncrx->p.retx_intv);

	/* oos timeout */
	if ((msg = msg_list_peek(&ncrx->oos_list)))
		when = min(when, msg->rx_at_mono + ncrx->p.oos_timeout);

	/* min 10ms intv to avoid busy loop in case something goes bonkers */
	return max(when, ncrx->now_mono + 10);
}