From: Alan T. DeKok Date: Tue, 17 May 2022 20:55:25 +0000 (-0400) Subject: put yielded increment / decrement into the callbacks X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a3aee1615ab0986cebe596c536e840e667de2943;p=thirdparty%2Ffreeradius-server.git put yielded increment / decrement into the callbacks which makes the main interpret loop a little clearer --- diff --git a/src/lib/unlang/interpret_synchronous.c b/src/lib/unlang/interpret_synchronous.c index b00320044e0..efe8bc7b8b1 100644 --- a/src/lib/unlang/interpret_synchronous.c +++ b/src/lib/unlang/interpret_synchronous.c @@ -118,17 +118,25 @@ static void _request_runnable(request_t *request, void *uctx) /** Interpreter yielded request * */ -static void _request_yield(request_t *request, UNUSED void *uctx) +static void _request_yield(request_t *request, void *uctx) { + unlang_interpret_synchronous_t *intps = uctx; + RDEBUG3("synchronous request yielded"); + + intps->yielded++; } /** Interpreter is starting to work on request again * */ -static void _request_resume(request_t *request, UNUSED void *uctx) +static void _request_resume(request_t *request, void *uctx) { + unlang_interpret_synchronous_t *intps = uctx; + RDEBUG3("synchronous request resumed"); + + intps->yielded--; } static bool _request_scheduled(request_t const *request, UNUSED void *uctx) @@ -255,8 +263,6 @@ rlm_rcode_t unlang_interpret_synchronous(fr_event_list_t *el, request_t *request continue; } - if (unlang_interpret_is_resumable(sub_request)) intps->yielded--; - /* * Continue interpretation until there's nothing * in the backlog. If this request YIELDs, then @@ -267,8 +273,6 @@ rlm_rcode_t unlang_interpret_synchronous(fr_event_list_t *el, request_t *request RDEBUG4("<<< interpreter (iteration %i) - %s", iterations, fr_table_str_by_value(rcode_table, sub_rcode, "")); - if (unlang_interpret_is_resumable(sub_request)) intps->yielded++; - if (sub_request == request) { rcode = sub_rcode; /*