From: Arran Cudbard-Bell Date: Thu, 18 Mar 2021 20:52:34 +0000 (+0000) Subject: Mark runnable not mark resumable X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cff870ea8919394df81432e2426e2f5b2c846f69;p=thirdparty%2Ffreeradius-server.git Mark runnable not mark resumable --- diff --git a/src/lib/curl/io.c b/src/lib/curl/io.c index d91e357427b..22bb491ca0d 100644 --- a/src/lib/curl/io.c +++ b/src/lib/curl/io.c @@ -91,7 +91,7 @@ static inline void _fr_curl_io_demux(fr_curl_handle_t *mhandle, CURLM *mandle) */ curl_multi_remove_handle(mandle, candle); - unlang_interpret_mark_resumable(request); + unlang_interpret_mark_runnable(request); } break; diff --git a/src/lib/unlang/interpret.c b/src/lib/unlang/interpret.c index a59992077d3..4f73f25a0b5 100644 --- a/src/lib/unlang/interpret.c +++ b/src/lib/unlang/interpret.c @@ -1171,7 +1171,7 @@ bool unlang_interpret_is_resumable(request_t *request) * * @param[in] request The current request. */ -void unlang_interpret_mark_resumable(request_t *request) +void unlang_interpret_mark_runnable(request_t *request) { unlang_stack_t *stack = request->stack; unlang_stack_frame_t *frame = &stack->frame[stack->depth]; diff --git a/src/lib/unlang/interpret.h b/src/lib/unlang/interpret.h index eccbfccba35..21c6e8a1858 100644 --- a/src/lib/unlang/interpret.h +++ b/src/lib/unlang/interpret.h @@ -60,7 +60,7 @@ rlm_rcode_t unlang_interpret_synchronous(request_t *request, CONF_SECTION *cs, r void *unlang_interpret_stack_alloc(TALLOC_CTX *ctx); -void unlang_interpret_mark_resumable(request_t *request); +void unlang_interpret_mark_runnable(request_t *request); bool unlang_interpret_is_resumable(request_t *request); diff --git a/src/lib/unlang/io.c b/src/lib/unlang/io.c index 4f710aed814..613001f44a0 100644 --- a/src/lib/unlang/io.c +++ b/src/lib/unlang/io.c @@ -27,35 +27,6 @@ RCSID("$Id$") #include #include "unlang_priv.h" -/** Run the interpreter after creating a subrequest. - * - * Just run some "unlang", but don't do anything else. - * - * This is a shim function added to 'fake' requests by the subrequest and parallel keywords. - */ -unlang_action_t unlang_io_process_interpret(rlm_rcode_t *p_result, UNUSED module_ctx_t const *mctx, request_t *request) -{ - rlm_rcode_t rcode; - - REQUEST_VERIFY(request); - - rcode = unlang_interpret(request); - - /* - * We've yielded, and can keep running. Do so. - */ - if ((rcode == RLM_MODULE_YIELD) && - (request->master_state != REQUEST_STOP_PROCESSING)) { - *p_result = RLM_MODULE_YIELD; - return UNLANG_ACTION_YIELD; - } - - /* - * Don't bother setting request->reply->code. - */ - RETURN_MODULE_HANDLED; -} - /** Allocate a child request based on the parent. * * @param[in] parent spawning the child request. diff --git a/src/lib/unlang/module.c b/src/lib/unlang/module.c index c1684fc1279..d5a485efe9f 100644 --- a/src/lib/unlang/module.c +++ b/src/lib/unlang/module.c @@ -124,7 +124,7 @@ static void unlang_module_event_timeout_handler(UNUSED fr_event_list_t *el, fr_t * Used when a module needs wait for an event. Typically the callback is set, and then the * module returns unlang_module_yield(). * - * @note The callback is automatically removed on unlang_interpret_mark_resumable(). + * @note The callback is automatically removed on unlang_interpret_mark_runnable(). * * param[in] request the current request. * param[in] callback to call. @@ -243,7 +243,7 @@ static void unlang_event_fd_error_handler(UNUSED fr_event_list_t *el, int fd, * Used when a module needs to read from an FD. Typically the callback is set, and then the * module returns unlang_module_yield(). * - * @note The callback is automatically removed on unlang_interpret_mark_resumable(). + * @note The callback is automatically removed on unlang_interpret_mark_runnable(). * * @param[in] request The current request. * @param[in] read callback. Used for receiving and demuxing/decoding data. @@ -736,7 +736,7 @@ static unlang_action_t unlang_module_resume(rlm_rcode_t *p_result, request_t *re * A common pattern is to use ``return unlang_module_yield(...)``. * * @param[in] request The current request. - * @param[in] resume Called on unlang_interpret_mark_resumable(). + * @param[in] resume Called on unlang_interpret_mark_runnable(). * @param[in] signal Called on unlang_action(). * @param[in] rctx to pass to the callbacks. * @return diff --git a/src/lib/unlang/module.h b/src/lib/unlang/module.h index e03989bb25d..103ecb41991 100644 --- a/src/lib/unlang/module.h +++ b/src/lib/unlang/module.h @@ -39,7 +39,7 @@ extern "C" { * Used when a module needs wait for an event. * Typically the callback is set, and then the module returns unlang_module_yield(). * - * @note The callback is automatically removed on unlang_interpret_mark_resumable(), i.e. if an event + * @note The callback is automatically removed on unlang_interpret_mark_runnable(), i.e. if an event * on a registered FD occurs before the timeout event fires. * * @param[in] mctx calling context for the module. @@ -55,7 +55,7 @@ typedef void (*unlang_module_timeout_t)(module_ctx_t const *mctx, request_t *req * Used when a module needs to read from an FD. Typically the callback is set, and then the * module returns unlang_module_yield(). * - * @note The callback is automatically removed on unlang_interpret_mark_resumable(), so + * @note The callback is automatically removed on unlang_interpret_mark_runnable(), so * * @param[in] mctx calling context for the module. * Contains global, thread-specific, and call-specific data for a module. @@ -84,7 +84,7 @@ typedef unlang_action_t (*unlang_module_resume_t)(rlm_rcode_t *p_result, module_ * A module may call unlang_yeild(), but still need to do something on FR_SIGNAL_DUP. If so, it's * set here. * - * @note The callback is automatically removed on unlang_interpret_mark_resumable(). + * @note The callback is automatically removed on unlang_interpret_mark_runnable(). * * @param[in] mctx calling context for the module. * Contains global, thread-specific, and call-specific data for a module. diff --git a/src/lib/unlang/parallel.c b/src/lib/unlang/parallel.c index 0c3721976f2..658ecfb7c83 100644 --- a/src/lib/unlang/parallel.c +++ b/src/lib/unlang/parallel.c @@ -131,7 +131,7 @@ static void unlang_parallel_child_signal(request_t *request, fr_state_signal_t a */ if (state->num_complete == state->num_children) { RDEBUG3("Signalling parent %s that all children have EXITED or DETACHED", request->parent->name); - unlang_interpret_mark_resumable(request->parent); + unlang_interpret_mark_runnable(request->parent); } return; @@ -153,7 +153,7 @@ static unlang_action_t unlang_parallel_child_done(UNUSED rlm_rcode_t *p_result, * the parent anything. Because we have that kind of * relationship. * - * Note that we call unlang_interpret_mark_resumable() here + * Note that we call unlang_interpret_mark_runnable() here * because unlang_parallel_process() calls * unlang_interpret(), and NOT child->async->process. */ @@ -177,7 +177,7 @@ static unlang_action_t unlang_parallel_child_done(UNUSED rlm_rcode_t *p_result, */ if (state->num_complete == state->num_children) { RDEBUG3("Signalling parent %s that all children have EXITED or DETACHED", request->parent->name); - unlang_interpret_mark_resumable(request->parent); + unlang_interpret_mark_runnable(request->parent); } } diff --git a/src/lib/unlang/tmpl.c b/src/lib/unlang/tmpl.c index 908b6eb9552..bf5a1d08796 100644 --- a/src/lib/unlang/tmpl.c +++ b/src/lib/unlang/tmpl.c @@ -203,7 +203,7 @@ static void unlang_tmpl_exec_waitpid(UNUSED fr_event_list_t *el, UNUSED pid_t pi if (state->exec.ev) fr_event_timer_delete(&state->exec.ev); - unlang_interpret_mark_resumable(request); + unlang_interpret_mark_runnable(request); } static void unlang_tmpl_exec_stdout_read(UNUSED fr_event_list_t *el, int fd, UNUSED int flags, void *uctx) @@ -308,7 +308,7 @@ static void unlang_tmpl_exec_timeout( state->exec.failed = true; unlang_tmpl_exec_cleanup(request); - unlang_interpret_mark_resumable(request); + unlang_interpret_mark_runnable(request); } diff --git a/src/lib/unlang/tmpl.h b/src/lib/unlang/tmpl.h index e3a5030c8c3..6104510c413 100644 --- a/src/lib/unlang/tmpl.h +++ b/src/lib/unlang/tmpl.h @@ -39,7 +39,7 @@ extern "C" { * A module may call unlang_yeild(), but still need to do something on FR_SIGNAL_DUP. If so, it's * set here. * - * @note The callback is automatically removed on unlang_interpret_mark_resumable(). + * @note The callback is automatically removed on unlang_interpret_mark_runnable(). * * @param[in] rctx Resume ctx for the callback. * @param[in] request The current request. diff --git a/src/lib/unlang/xlat.c b/src/lib/unlang/xlat.c index 73493e8fffb..05a78193b44 100644 --- a/src/lib/unlang/xlat.c +++ b/src/lib/unlang/xlat.c @@ -370,7 +370,7 @@ static unlang_action_t unlang_xlat_resume(rlm_rcode_t *p_result, request_t *requ * A common pattern is to use ``return unlang_xlat_yield(...)``. * * @param[in] request The current request. - * @param[in] resume Called on unlang_interpret_mark_resumable(). + * @param[in] resume Called on unlang_interpret_mark_runnable(). * @param[in] signal Called on unlang_action(). * @param[in] rctx to pass to the callbacks. * @return always returns RLM_MODULE_YIELD. diff --git a/src/lib/unlang/xlat.h b/src/lib/unlang/xlat.h index 1d63e5a5662..98d9abc6d28 100644 --- a/src/lib/unlang/xlat.h +++ b/src/lib/unlang/xlat.h @@ -131,7 +131,7 @@ typedef struct { * Used when a xlat needs wait for an event. * Typically the callback is set, and then the xlat returns unlang_xlat_yield(). * - * @note The callback is automatically removed on unlang_interpret_mark_resumable(), i.e. if an event + * @note The callback is automatically removed on unlang_interpret_mark_runnable(), i.e. if an event * on a registered FD occurs before the timeout event fires. * * @param[in] request the request. @@ -148,7 +148,7 @@ typedef void (*fr_unlang_xlat_timeout_t)(request_t *request, void *xlat_inst, * Used when a xlat needs to read from an FD. Typically the callback is set, and then the * xlat returns unlang_xlat_yield(). * - * @note The callback is automatically removed on unlang_interpret_mark_resumable(), so + * @note The callback is automatically removed on unlang_interpret_mark_runnable(), so * * @param[in] request the current request. * @param[in] xlat_inst the xlat instance. @@ -206,7 +206,7 @@ typedef xlat_action_t (*xlat_func_resume_t)(TALLOC_CTX *ctx, fr_dcursor_t *out, /** A callback when the request gets a fr_state_signal_t. * - * @note The callback is automatically removed on unlang_interpret_mark_resumable(). + * @note The callback is automatically removed on unlang_interpret_mark_runnable(). * * @param[in] request The current request. * @param[in] xlat_inst the xlat instance. diff --git a/src/modules/rlm_delay/rlm_delay.c b/src/modules/rlm_delay/rlm_delay.c index 42630d8c8ac..d362426fae3 100644 --- a/src/modules/rlm_delay/rlm_delay.c +++ b/src/modules/rlm_delay/rlm_delay.c @@ -64,7 +64,7 @@ static void _delay_done(UNUSED module_ctx_t const *mctx, request_t *request, voi */ if (!fr_cond_assert(fired >= *yielded)) REDEBUG("Unexpected resume time"); - unlang_interpret_mark_resumable(request); + unlang_interpret_mark_runnable(request); } static void _xlat_delay_done(request_t *request, @@ -80,7 +80,7 @@ static void _xlat_delay_done(request_t *request, */ if (!fr_cond_assert(fired > *yielded)) REDEBUG("Unexpected resume time"); - unlang_interpret_mark_resumable(request); + unlang_interpret_mark_runnable(request); } static int delay_add(request_t *request, fr_time_t *resume_at, fr_time_t now, diff --git a/src/modules/rlm_icmp/rlm_icmp.c b/src/modules/rlm_icmp/rlm_icmp.c index 8bf089fbf41..a0f29f9ae02 100644 --- a/src/modules/rlm_icmp/rlm_icmp.c +++ b/src/modules/rlm_icmp/rlm_icmp.c @@ -167,7 +167,7 @@ static void _xlat_icmp_timeout(request_t *request, RDEBUG2("No response to ICMP request for %pV (counter=%d)", echo->ip, echo->counter); - unlang_interpret_mark_resumable(request); + unlang_interpret_mark_runnable(request); } /** Xlat to delay the request @@ -377,7 +377,7 @@ static void mod_icmp_read(UNUSED fr_event_list_t *el, UNUSED int sockfd, UNUSED * We have a reply! */ echo->replied = true; - unlang_interpret_mark_resumable(echo->request); + unlang_interpret_mark_runnable(echo->request); } static void mod_icmp_error(fr_event_list_t *el, UNUSED int sockfd, UNUSED int flags, diff --git a/src/modules/rlm_radius/rlm_radius.c b/src/modules/rlm_radius/rlm_radius.c index 84c94fbac72..9164cc58312 100644 --- a/src/modules/rlm_radius/rlm_radius.c +++ b/src/modules/rlm_radius/rlm_radius.c @@ -380,7 +380,7 @@ static void mod_radius_signal(module_ctx_t const *mctx, request_t *request, void } -/** Continue after unlang_interpret_mark_resumable() +/** Continue after unlang_interpret_mark_runnable() * */ static unlang_action_t mod_radius_resume(rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request, void *ctx) diff --git a/src/modules/rlm_radius/rlm_radius_udp.c b/src/modules/rlm_radius/rlm_radius_udp.c index 738d8ed2140..9f33388629b 100644 --- a/src/modules/rlm_radius/rlm_radius_udp.c +++ b/src/modules/rlm_radius/rlm_radius_udp.c @@ -2555,7 +2555,7 @@ static void request_fail(request_t *request, void *preq, void *rctx, r->rcode = RLM_MODULE_FAIL; r->treq = NULL; - unlang_interpret_mark_resumable(request); + unlang_interpret_mark_runnable(request); } /** Response has already been written to the rctx at this point @@ -2572,7 +2572,7 @@ static void request_complete(request_t *request, void *preq, void *rctx, UNUSED r->treq = NULL; - unlang_interpret_mark_resumable(request); + unlang_interpret_mark_runnable(request); } /** Explicitly free resources associated with the protocol request diff --git a/src/modules/rlm_sigtran/client.c b/src/modules/rlm_sigtran/client.c index 261f54f8f52..4673a33c03c 100644 --- a/src/modules/rlm_sigtran/client.c +++ b/src/modules/rlm_sigtran/client.c @@ -133,7 +133,7 @@ static void _sigtran_pipe_read(UNUSED fr_event_list_t *el, int fd, UNUSED int fl if (txn->ctx.defunct) return; /* Request was stopped */ fr_assert(txn->ctx.request); - unlang_interpret_mark_resumable(txn->ctx.request); /* Continue processing */ + unlang_interpret_mark_runnable(txn->ctx.request); /* Continue processing */ } /** Called by a new thread to register a new req_pipe