Skip to content

Commit

Permalink
clear timers and remove (now wrong) assert
Browse files Browse the repository at this point in the history
  • Loading branch information
alandekok committed Oct 2, 2017
1 parent 02bbd06 commit 3eaeed0
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/modules/rlm_radius/rlm_radius_udp.c
Expand Up @@ -1300,7 +1300,7 @@ static int conn_write(rlm_radius_udp_connection_t *c, rlm_radius_udp_request_t *
u->link->time_sent = fr_time();
fr_time_to_timeval(&u->timer.start, u->link->time_sent);

if (proxy_state) {
if (u != c->status_u) {
c->num_requests++;

/*
Expand Down Expand Up @@ -1658,7 +1658,7 @@ static fr_connection_state_t _conn_open(UNUSED fr_event_list_t *el, UNUSED int f
* Status-Server checks. Manually build the packet, and
* all of it's associated glue.
*/
if (c->inst->parent->status_check) {
if (c->inst->parent->status_check && !c->status_u) {
rlm_radius_link_t *link;
rlm_radius_udp_request_t *u;
REQUEST *request;
Expand Down Expand Up @@ -1720,7 +1720,7 @@ static fr_connection_state_t _conn_open(UNUSED fr_event_list_t *el, UNUSED int f
*/
u->rr = rr_track_alloc(c->id, request, u->code, link, &u->timer);
if (!u->rr) {
ERROR("%s - Failed allocating status_check ID for new connection %s",
ERROR("%s - Failed allocating status_check ID for connection %s",
c->inst->parent->name, c->name);
talloc_free(u);
talloc_free(link);
Expand All @@ -1733,6 +1733,13 @@ static fr_connection_state_t _conn_open(UNUSED fr_event_list_t *el, UNUSED int f
}
}

/*
* Reset the timer, retransmission counters, etc.
*/
if (c->status_u) {
memset(&c->status_u->timer, 0, sizeof(c->status_u->timer));
}

/*
* Now that we're open, also push pending requests from
* the main thread queue onto the queue for this
Expand Down Expand Up @@ -2011,7 +2018,9 @@ static rlm_radius_udp_connection_t *connection_get(rlm_radius_udp_thread_t *t, r
return NULL;
}

rad_assert(u->timer.count == 0);
/*
* Don't check or reset the timers, mrc, mrt, etc.
*/
u->c = c;

fr_heap_extract(t->active, c);
Expand Down

0 comments on commit 3eaeed0

Please sign in to comment.