/*
* Send the packets as one system call.
- *
- * @todo - just dump all of the packets into h->send, as "under the hood",
- * writev() calls malloc(), copies all of the data there, then write(),
- * and finally free().
*/
sent = write(h->fd, h->send->read, h->send->write - h->send->read);
if (sent < 0) { /* Error means no messages were sent */
/*
* For all messages that were actually sent by writev()
* start the request timer.
- *
- * @todo - count over _bytes_ sent, not _number of packets_ sent!
*/
for (i = 0, p = h->send->read; (i < queued) && (written < h->send->write); i++) {
fr_trunk_request_t *treq = h->coalesced[i];
h->last_sent = u->retry.start;
if (fr_time_lteq(h->first_sent, h->last_idle)) h->first_sent = h->last_sent;
-
if (fr_event_timer_at(u, el, &u->ev, u->retry.next, request_retry, treq) < 0) {
RERROR("Failed inserting retransmit timeout for connection");
fr_trunk_request_signal_fail(treq);
}
/*
- * If the packet doesn't get a response,
- * then udp_request_free() will notice, and run conn_zombie()
+ * If the packet doesn't get a response, then the timer will hit
+ * and will retransmit.
*/
- RDEBUG("Sent request. Relying on NAS to perform more retransmissions");
-
}
+
/*
* Requests that weren't sent get re-enqueued. Which means that they get re-encoded, but oh well.
*
udp_result_t *r = talloc_get_type_abort(rctx, udp_result_t);
udp_request_t *u = talloc_get_type_abort(preq, udp_request_t);
- // @todo - assert the request is not outstanding
fr_assert(u->packet && !u->ev); /* Dealt with by request_conn_release */
fr_assert(state != FR_TRUNK_REQUEST_STATE_INIT);
udp_result_t *r = talloc_get_type_abort(rctx, udp_result_t);
udp_request_t *u = talloc_get_type_abort(preq, udp_request_t);
- // @todo - assert the request is not outstanding
fr_assert(!u->packet && !u->ev); /* Dealt with by request_conn_release */
r->treq = NULL;
{
udp_request_t *u = talloc_get_type_abort(preq_to_free, udp_request_t);
- // @todo - assert the request is not outstanding
fr_assert(!u->packet && !u->ev); /* Dealt with by request_conn_release */
talloc_free(u);
}
#endif
-/** Free a udp_request_t
- */
-static int _udp_request_free(udp_request_t *u)
-{
- if (u->ev) (void) fr_event_timer_delete(&u->ev);
-
- // @todo - assert the request is not outstanding
-
- return 0;
-}
-
static unlang_action_t mod_enqueue(rlm_rcode_t *p_result, void **rctx_out, UNUSED void *instance, void *thread, request_t *request)
{
udp_thread_t *t = talloc_get_type_abort(thread, udp_thread_t);
r->rcode = RLM_MODULE_FAIL;
if (fr_trunk_request_enqueue(&treq, t->trunk, request, u, r) < 0) {
- // @todo - assert the request is not outstanding
fr_assert(!u->packet); /* Should not have been fed to the muxer */
fr_trunk_request_free(&treq); /* Return to the free list */
talloc_free(r);
r->treq = treq; /* Remember for signalling purposes */
- talloc_set_destructor(u, _udp_request_free);
-
*rctx_out = r;
return UNLANG_ACTION_YIELD;