]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
trunk: Add back previous functionality to allow requests to be assigned to the backlo...
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Mon, 2 Mar 2020 15:17:17 +0000 (09:17 -0600)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Mon, 2 Mar 2020 15:17:17 +0000 (09:17 -0600)
src/lib/server/trunk.c
src/lib/server/trunk.h
src/lib/server/trunk_tests.c

index 90717895cac1182d2ff875d2d2aad3116402dd13..9033622c243c8f271704a6608971cd431203b0b2 100644 (file)
@@ -1168,7 +1168,8 @@ static fr_trunk_enqueue_t trunk_request_check_enqueue(fr_trunk_connection_t **tc
         *      we refuse to enqueue new requests until
         *      one or more connections comes online.
         */
-       if (trunk->last_failed && (trunk->last_failed >= trunk->last_connected)) {
+       if (!trunk->conf.backlog_on_failed_conn &&
+           trunk->last_failed && (trunk->last_failed >= trunk->last_connected)) {
                ROPTIONAL(RWARN, WARN, "Refusing to enqueue requests - "
                          "No active connections and last event was a connection failure");
 
index 7696b6bc0493e7079d01e8b9c76a33cd5a70376e..c72f4669760714625ed599d1401b68623270f6be 100644 (file)
@@ -227,6 +227,10 @@ typedef struct {
                                                        ///< If this is true, #fr_trunk_connection_signal_writable
                                                        ///< does not need to be called, and requests will be
                                                        ///< enqueued as soon as they're received.
+
+       bool                    backlog_on_failed_conn; //!< Assign requests to the backlog when there are no
+                                                       //!< available connections and the last connection event
+                                                       //!< was a failure, instead of failing them immediately.
 } fr_trunk_conf_t;
 
 /** Public fields for the trunk request
index 891fc937fb5416a8261fbe29b054c18e044fcb9c..1228f518f69ed8bf5598e86656d989c11c617c44 100644 (file)
@@ -624,7 +624,7 @@ static void test_socket_pair_alloc_then_reconnect_check_delay(void)
        TEST_CHECK(fr_connection_get_num_reconnected(tconn->pub.conn) == 1);
 
        events = fr_event_corral(el, test_time_base, true);
-       TEST_CHECK(events == 2);        /* Should have a pending I/O event and a timer */
+       TEST_CHECK(events == 1);        /* Should have a pending I/O event and a timer */
 
        talloc_free(trunk);
        talloc_free(ctx);
@@ -1067,7 +1067,8 @@ static void test_requeue_on_reconnect(void)
                                        .manage_interval = NSEC * 0.5,
                                        .conn_conf = &(fr_connection_conf_t){
                                                .reconnection_delay = NSEC * 0.1
-                                       }
+                                       },
+                                       .backlog_on_failed_conn = true
                                };
        test_proto_request_t    *preq;
        fr_trunk_request_t      *treq = NULL;