]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
re-initialize the status check packet on connection failed
authorAlan T. DeKok <aland@freeradius.org>
Mon, 2 Oct 2017 13:11:11 +0000 (09:11 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 2 Oct 2017 13:15:44 +0000 (09:15 -0400)
and remove any pending writes, events, etc.

src/modules/rlm_radius/rlm_radius_udp.c

index 7b814b7f4f2eb7bb31f02b7293e286a6f947048c..636428186c65fcf3bc130ac55ccf8ef9c35aaddb 100644 (file)
@@ -1551,9 +1551,21 @@ static fr_connection_state_t _conn_failed(int fd, fr_connection_state_t state, v
                fr_dlist_t *entry;
 
                /*
-                *      Stop all Status-Server checks
+                *      Reset the Status-Server checks.
                 */
-               if (c->status_u) TALLOC_FREE(c->status_u);
+               if (c->status_u) {
+                       rlm_radius_udp_request_t *u = c->status_u;
+
+                       memset(&u->timer, 0, sizeof(u->timer));
+                       rad_assert(u->c == c);
+
+                       if (u->packet) TALLOC_FREE(u->packet);
+                       u->packet_len = 0;
+
+                       if (u->timer.ev) (void) fr_event_timer_delete(c->thread->el, &u->timer.ev);
+                       fr_dlist_remove(&u->entry);
+                       (void) fr_heap_extract(c->queued, c->status_u);
+               }
 
                /*
                 *      Delete all timers associated with the connection.