]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Move trunk triggers boolean to trunk->conf
authorNick Porter <nick@portercomputing.co.uk>
Thu, 21 Aug 2025 18:16:16 +0000 (19:16 +0100)
committerNick Porter <nick@portercomputing.co.uk>
Mon, 25 Aug 2025 13:56:10 +0000 (14:56 +0100)
Splitting between connection and request and add CONF_PARSER rules to
set the options.

src/lib/server/trunk.c
src/lib/server/trunk.h

index 8fec7e8557d53524a5be907c6ba7df205d645868..fa2f04ff6b48cb33db4b209147290d423fde45b2 100644 (file)
@@ -299,6 +299,7 @@ static conf_parser_t const trunk_config_request[] = {
        { FR_CONF_OFFSET("per_connection_max", trunk_conf_t, max_req_per_conn), .dflt = "2000" },
        { FR_CONF_OFFSET("per_connection_target", trunk_conf_t, target_req_per_conn), .dflt = "1000" },
        { FR_CONF_OFFSET("free_delay", trunk_conf_t, req_cleanup_delay), .dflt = "10.0" },
+       { FR_CONF_OFFSET("triggers", trunk_conf_t, req_triggers) },
 
        CONF_PARSER_TERMINATOR
 };
@@ -327,6 +328,8 @@ conf_parser_t const trunk_config[] = {
 
        { FR_CONF_OFFSET("max_backlog", trunk_conf_t, max_backlog), .dflt = "1000" },
 
+       { FR_CONF_OFFSET("triggers", trunk_conf_t, conn_triggers) },
+
        { FR_CONF_OFFSET_SUBSECTION("connection", 0, trunk_conf_t, conn_conf, trunk_config_connection), .subcs_size = sizeof(trunk_config_connection) },
        { FR_CONF_POINTER("request", 0, CONF_FLAG_SUBSECTION, NULL), .subcs = (void const *) trunk_config_request },
 
@@ -430,7 +433,7 @@ static fr_table_num_ordered_t const trunk_connection_events[] = {
 static size_t trunk_connection_events_len = NUM_ELEMENTS(trunk_connection_events);
 
 #define CONN_TRIGGER(_state) do { \
-       if (trunk->pub.triggers) { \
+       if (trunk->conf.conn_triggers) { \
                trigger(unlang_interpret_get_thread_default(), \
                             NULL, fr_table_str_by_value(trunk_conn_trigger_names, _state, \
                                                         "<INVALID>"), true, NULL); \
@@ -461,7 +464,7 @@ void trunk_request_state_log_entry_add(char const *function, int line,
                                       trunk_request_t *treq, trunk_request_state_t new) CC_HINT(nonnull);
 
 #define REQUEST_TRIGGER(_state) do { \
-       if (trunk->pub.triggers) { \
+       if (trunk->conf.req_triggers) { \
                trigger(unlang_interpret_get_thread_default(), \
                             NULL, fr_table_str_by_value(trunk_req_trigger_names, _state, \
                                                         "<INVALID>"), true, NULL); \
index 2b970de78938d0f97a294bdd47f6d2ecd4a1bfe8..57ee9ba5b075d2000647f9084166aa69d2a6f8aa 100644 (file)
@@ -281,6 +281,10 @@ typedef struct {
        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.
+
+       bool                    conn_triggers;          //!< Do we run connection related triggers?
+
+       bool                    req_triggers;           //!< Do we run request related triggers?
 } trunk_conf_t;
 
 /** Public fields for the trunk
@@ -328,8 +332,6 @@ struct trunk_pub_s {
        uint64_t _CONST         req_alloc_reused;       //!< How many requests were reused.
        /** @} */
 
-       bool _CONST             triggers;               //!< do we run the triggers?
-
        trunk_state_t _CONST    state;                  //!< Current state of the trunk.
 };