return 2;
}
- /*
- * Start the retransmission timers.
- */
- u->link->time_sent = fr_time();
- fr_time_to_timeval(&u->timer.start, u->link->time_sent);
-
if (u != c->status_u) {
/*
* Only copy the packet if we're not replicating,
u->packet_len = packet_len;
if (!c->inst->parent->synchronous) {
- if (rr_track_start(&u->timer) < 0) {
- RDEBUG("%s - Failed starting retransmit tracking for connection %s",
- c->inst->parent->name, c->name);
- return -1;
- }
-
- if (fr_event_timer_insert(u, c->thread->el, &u->timer.ev, &u->timer.next,
- response_timeout, u) < 0) {
- RDEBUG("%s - Failed starting retransmit tracking for connection %s",
- c->inst->parent->name, c->name);
- return -1;
- }
-
RDEBUG("Proxying request. Expecting response within %d.%06ds",
u->timer.rt / USEC, u->timer.rt % USEC);
state_transition(u, PACKET_STATE_SENT);
/*
- * The packet already has a timer associated with
- * it. Don't send it right now, but instead just
- * put it into the "sent" list, so that it will
- * be sent when the timer fires.
+ * If we're retransmitting the packet, wait for
+ * the timer to fire. Otherwise, send the packet now.
*/
- if (u->timer.ev) {
+ if (u->timer.count > 1) {
continue;
}
*/
state_transition(u, PACKET_STATE_THREAD);
+ /*
+ * Start the retransmission timers.
+ */
+ u->link->time_sent = fr_time();
+ fr_time_to_timeval(&u->timer.start, u->link->time_sent);
+
+ if (rr_track_start(&u->timer) < 0) {
+ RDEBUG("%s - Failed starting retransmit tracking", inst->parent->name);
+ talloc_free(u);
+ return RLM_MODULE_FAIL;
+ }
+
+ if (fr_event_timer_insert(u, t->el, &u->timer.ev, &u->timer.next,
+ response_timeout, u) < 0) {
+ RDEBUG("%s - Failed starting retransmit tracking",
+ inst->parent->name);
+ talloc_free(u);
+ return RLM_MODULE_FAIL;
+ }
+
/*
* There are OTHER pending writes, wait for the event
* callbacks to wake up a connection and send the packet.