From: Alan T. DeKok Date: Mon, 14 Nov 2022 14:52:26 +0000 (-0500) Subject: move counters to callbacks X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=85ee1556b56f82ba09d43fc7bc57847d53b5c969;p=thirdparty%2Ffreeradius-server.git move counters to callbacks where they're correct, rather than using ad-hoc and in-line things --- diff --git a/src/lib/unlang/interpret_synchronous.c b/src/lib/unlang/interpret_synchronous.c index 94e89238ab3..eecc80bc465 100644 --- a/src/lib/unlang/interpret_synchronous.c +++ b/src/lib/unlang/interpret_synchronous.c @@ -114,6 +114,9 @@ static void _request_runnable(request_t *request, void *uctx) { unlang_interpret_synchronous_t *intps = uctx; + fr_assert(intps->yielded > 0); + intps->yielded--; + fr_heap_insert(&intps->runnable, request); } @@ -122,6 +125,10 @@ static void _request_runnable(request_t *request, void *uctx) */ static void _request_yield(request_t *request, UNUSED void *uctx) { + unlang_interpret_synchronous_t *intps = uctx; + + intps->yielded++; + RDEBUG3("synchronous request yielded"); } @@ -206,7 +213,6 @@ rlm_rcode_t unlang_interpret_synchronous(fr_event_list_t *el, request_t *request el = intps->el; rcode = unlang_interpret(request); - if (unlang_interpret_is_resumable(request)) intps->yielded++; while ((dont_wait_for_event = (fr_heap_num_elements(intps->runnable) > 0)) || (intps->yielded > 0)) { @@ -255,8 +261,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 +271,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; /*