]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
put yielded increment / decrement into the callbacks
authorAlan T. DeKok <aland@freeradius.org>
Tue, 17 May 2022 20:55:25 +0000 (16:55 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 17 May 2022 20:55:25 +0000 (16:55 -0400)
which makes the main interpret loop a little clearer

src/lib/unlang/interpret_synchronous.c

index b00320044e09bd15a637250763f5df148bb8bb34..efe8bc7b8b17bfd2530b6e8233d1b39633e1c8f6 100644 (file)
@@ -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, "<INVALID>"));
 
-               if (unlang_interpret_is_resumable(sub_request)) intps->yielded++;
-
                if (sub_request == request) {
                        rcode = sub_rcode;
                /*