]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Revert "put yielded increment / decrement into the callbacks"
authorAlan T. DeKok <aland@freeradius.org>
Wed, 18 May 2022 00:15:19 +0000 (20:15 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 18 May 2022 00:15:25 +0000 (20:15 -0400)
This reverts commit a3aee1615ab0986cebe596c536e840e667de2943.

intp->func.resume() is called when a request _starts_ running
for the first time, too.  Which means that we can't decrement
the "yielded" count, because it's already at zero

src/lib/unlang/interpret_synchronous.c

index 15347c9e33bffd88a14af10ff9a904152dfa452e..601270803921e058edca2af27750dac926e2c89c 100644 (file)
@@ -118,25 +118,17 @@ static void _request_runnable(request_t *request, void *uctx)
 /** Interpreter yielded request
  *
  */
-static void _request_yield(request_t *request, void *uctx)
+static void _request_yield(request_t *request, UNUSED 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, void *uctx)
+static void _request_resume(request_t *request, UNUSED 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)
@@ -261,6 +253,8 @@ 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
@@ -271,6 +265,8 @@ 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, "<INVALID>"));
 
+               if (unlang_interpret_is_resumable(sub_request)) intps->yielded++;
+
                if (sub_request == request) {
                        rcode = sub_rcode;
                /*