From: Alan T. DeKok Date: Sun, 27 Jul 2025 11:36:26 +0000 (-0400) Subject: remove unused function ulang_timeout_section_push() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e4053decd8ff159ba146a8c8c382fb617736061a;p=thirdparty%2Ffreeradius-server.git remove unused function ulang_timeout_section_push() --- diff --git a/src/lib/unlang/timeout.c b/src/lib/unlang/timeout.c index e76fa03bdb..33a2d8c4a9 100644 --- a/src/lib/unlang/timeout.c +++ b/src/lib/unlang/timeout.c @@ -24,7 +24,6 @@ */ RCSID("$Id$") -#include #include #include #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 index 16947adba1..0000000000 --- a/src/lib/unlang/timeout.h +++ /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 - -#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