]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
remove unused function ulang_timeout_section_push()
authorAlan T. DeKok <aland@freeradius.org>
Sun, 27 Jul 2025 11:36:26 +0000 (07:36 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Sun, 27 Jul 2025 11:36:26 +0000 (07:36 -0400)
src/lib/unlang/timeout.c
src/lib/unlang/timeout.h [deleted file]

index e76fa03bdb6c08471d8481f094ca34db72d421f7..33a2d8c4a994a884a6ab2f5fb36deb183cb0f8f6 100644 (file)
@@ -24,7 +24,6 @@
  */
 RCSID("$Id$")
 
-#include <freeradius-devel/unlang/timeout.h>
 #include <freeradius-devel/unlang/interpret.h>
 #include <freeradius-devel/server/rcode.h>
 #include "group_priv.h"
@@ -41,8 +40,6 @@ typedef struct {
        fr_timer_t                              *ev;
 
        fr_value_box_list_t                     result;
-
-       unlang_t                                *instruction;   //!< to run on timeout
 } unlang_frame_state_timeout_t;
 
 /** Immediately cancel the timeout if the frame is cancelled
@@ -92,16 +89,6 @@ static void unlang_timeout_handler(UNUSED fr_timer_list_t *tl, UNUSED fr_time_t
        state->fired = true;
 
        RINDENT_RESTORE(request, state);
-
-       if (!state->instruction) return;
-
-       /*
-        *      Push something else onto the stack to execute.
-        */
-       if (unlikely(unlang_interpret_push_instruction(NULL, request, state->instruction,
-                                                      FRAME_CONF(RLM_MODULE_TIMEOUT, true)) < 0)) {
-               unlang_interpret_signal(request, FR_SIGNAL_CANCEL); /* also stops the request and does cleanups */
-       }
 }
 
 static unlang_action_t unlang_timeout_resume_done(unlang_result_t *p_result, UNUSED request_t *request, unlang_stack_frame_t *frame)
@@ -182,75 +169,6 @@ static unlang_action_t unlang_timeout(unlang_result_t *p_result, request_t *requ
        return UNLANG_ACTION_PUSHED_CHILD;
 }
 
-/** When a timeout fires, run the given section.
- *
- * @param[in] request          to push timeout onto
- * @param[in] timeout          when to run the timeout
- * @param[in] cs               section to run when the timeout fires.
- * @param[in] top_frame                Set to UNLANG_TOP_FRAME if the interpreter should return.
- *                             Set to UNLANG_SUB_FRAME if the interprer should continue.
- *
- * @return
- *     - 0 on success.
- *     - -1 on failure.
- */
-int unlang_timeout_section_push(request_t *request, CONF_SECTION *cs, fr_time_delta_t timeout, bool top_frame)
-{
-       /** Static instruction for performing xlat evaluations
-        *
-        */
-       static unlang_t timeout_instruction = {
-               .type = UNLANG_TYPE_TIMEOUT,
-               .name = "timeout",
-               .debug_name = "timeout",
-               .actions = MOD_ACTIONS_FAIL_TIMEOUT_RETURN,
-       };
-
-       unlang_frame_state_timeout_t    *state;
-       unlang_stack_t                  *stack = request->stack;
-       unlang_stack_frame_t            *frame;
-       unlang_t                        *instruction;
-
-       /*
-        *      Get the instruction we are supposed to run on timeout.
-        */
-       instruction = (unlang_t *)cf_data_value(cf_data_find(cs, unlang_group_t, NULL));
-       if (!instruction) {
-               REDEBUG("Failed to find pre-compiled unlang for section %s { ... }",
-                       cf_section_name1(cs));
-               return -1;
-       }
-
-       /*
-        *      Push a new timeout frame onto the stack
-        */
-       if (unlang_interpret_push(NULL, request, &timeout_instruction,
-                                 FRAME_CONF(RLM_MODULE_NOT_SET, top_frame), UNLANG_NEXT_STOP) < 0) return -1;
-       frame = &stack->frame[stack->depth];
-
-       /*
-        *      Allocate its state, and set the timeout.
-        */
-       MEM(frame->state = state = talloc_zero(stack, unlang_frame_state_timeout_t));
-
-       RINDENT_SAVE(state, request);
-       state->depth = stack->depth;
-       state->request = request;
-       state->timeout = timeout;
-       state->instruction = instruction;
-
-       if (fr_timer_in(state, unlang_interpret_event_list(request)->tl, &state->ev, timeout,
-                       false, unlang_timeout_handler, state) < 0) {
-               RPEDEBUG("Failed setting timeout for section %s", cf_section_name1(cs));
-               return -1;
-       }
-
-       frame_repeat(frame, unlang_timeout_resume_done);
-
-       return 0;
-
-}
-
 static unlang_t *unlang_compile_timeout(unlang_t *parent, unlang_compile_ctx_t *unlang_ctx, CONF_ITEM const *ci)
 {
        CONF_SECTION            *cs = cf_item_to_section(ci);
diff --git a/src/lib/unlang/timeout.h b/src/lib/unlang/timeout.h
deleted file mode 100644 (file)
index 16947ad..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-#pragma once
-/*
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software Foundation,
- *  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-/**
- * $Id$
- *
- * @file unlang/timeout.h
- * @brief Declarations for unlang timeouts
- *
- * @copyright 2023 Network RADIUS SAS (legal@networkradius.com)
- */
-#include <freeradius-devel/server/request.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int    unlang_timeout_section_push(request_t *request, CONF_SECTION *cs, fr_time_delta_t timeout, bool top_frame) CC_HINT(nonnull);
-
-#ifdef __cplusplus
-}
-#endif