if (!now) now = fr_time();
+ if (!h->last_reply && !h->last_sent) return;
+
/*
* We have recent replies, do nothing.
*/
if (data_len < 0) {
if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) return NULL;
+ DEBUG("Failed reading from socket: %s", fr_syserror(errno));
fr_trunk_connection_signal_reconnect(c->tconn, FR_CONNECTION_FAILED);
return NULL;
}
{
udp_handle_t *h;
+ if (u->ev) (void) fr_event_timer_delete(&u->ev);
+
/*
* We don't have a connection, so we can't update any of
* the connection timers or states.
*/
if (!u->c) return 0;
- if (u->ev) (void) fr_event_timer_delete(&u->ev);
-
- h = talloc_get_type_abort(u->c->conn->h, udp_handle_t);
-
/*
- * The module is doing async proxying, we don't need to
- * do more.
+ * No resources allocated to the packet.
*/
- if (!u->synchronous) return 0;
+ if (!u->rr) return 0;
- if (u->rr) (void) rr_track_delete(h->id, u->rr);
+ /*
+ * @todo - this crashes on exit if there are pending
+ * requests, because "conn" is freed before this function
+ * is called.
+ */
+ h = talloc_get_type_abort(u->c->conn->h, udp_handle_t);
+ (void) rr_track_delete(h->id, u->rr);
return 0;
}