]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Don't close the final connection on a trunk if the last event was a failure
authorNick Porter <nick@portercomputing.co.uk>
Tue, 4 Jun 2024 07:42:42 +0000 (08:42 +0100)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Fri, 7 Jun 2024 02:26:58 +0000 (22:26 -0400)
Closing this last connection can lead to no active connections and the
last event being a failure, which then blocks enqueueing of new
requests.

src/lib/server/trunk.c

index f8c61fb7fbf0a95ad060941353800113bfbbe585..c0cc9d60ff0c220d5ff80d901bcbbd57057d454e 100644 (file)
@@ -4369,6 +4369,19 @@ static void trunk_manage(fr_trunk_t *trunk, fr_time_t now)
                        return;
                }
 
+               /*
+                *      If the last event on the trunk was a connection failure and
+                *      there is only one connection, this may well be a reconnect
+                *      attempt after a failure - and needs to persist otherwise
+                *      the last event will be a failure and no new connection will
+                *      be made, leading to no new requests being enqueued.
+                */
+               if (fr_time_gt(trunk->pub.last_failed, fr_time_wrap(0)) &&
+                   fr_time_lt(trunk->pub.last_connected, trunk->pub.last_failed) && (conn_count == 1)) {
+                       DEBUG4("Not closing remaining connection - last event was a failure");
+                       return;
+               }
+
                /*
                 *      Inactive connections get counted in the
                 *      set of viable connections, but are likely