]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Remove request->backlog
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Tue, 30 Mar 2021 10:22:22 +0000 (11:22 +0100)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 31 Mar 2021 15:12:42 +0000 (16:12 +0100)
src/lib/server/request.h
src/lib/unlang/interpret.c
src/lib/unlang/interpret.h
src/lib/unlang/interpret_synchronous.c
src/lib/unlang/parallel.c
src/modules/proto_ldap_sync/proto_ldap_sync.c

index bf30e174c6ef24fc3ca198a2d6304e8615a4e5e4..bb1520d7f8dcc057fedd086c6ecd7fae87c690d1 100644 (file)
@@ -191,7 +191,6 @@ struct request_s {
        fr_radius_packet_t      *reply;         //!< Outgoing response.
 
        fr_event_list_t         *el;            //!< thread-specific event list.
-       fr_heap_t               *backlog;       //!< thread-specific backlog
        request_state_t         request_state;  //!< state for the various protocol handlers.
 
        RADCLIENT               *client;        //!< The client that originally sent us the request.
index 9fe02ce974252babfadd89635a24a58028109b83..594bb1eedf07b1cfd9eb08ba927cf1e73e297307 100644 (file)
@@ -108,19 +108,6 @@ static void stack_dump(request_t *request)
 #define DUMP_STACK
 #endif
 
-static inline CC_HINT(always_inline)
-void request_done(request_t *request)
-{
-       unlang_stack_t          *stack = request->stack;
-       unlang_interpret_t      *intp = stack->intp;
-
-       if (request_is_internal(request)) {
-               intp->funcs.done_internal(request, stack->result, intp->uctx);
-       } else {
-               intp->funcs.done_external(request, stack->result, intp->uctx);
-       }
-}
-
 /** Push a new frame onto the stack
  *
  * @param[in] request          to push the frame onto.
@@ -696,7 +683,7 @@ CC_HINT(hot) rlm_rcode_t unlang_interpret(request_t *request)
         *      This usually means the request is complete in its
         *      entirety.
         */
-       if (stack->depth == 0) request_done(request);
+       if (stack->depth == 0) unlang_interpret_request_done(request);
 
        return rcode;
 }
@@ -879,7 +866,7 @@ void unlang_interpret_signal(request_t *request, fr_state_signal_t action)
         */
        if (stack && (stack->depth > 0)) frame_signal(request, action, 0);
 
-       if (action == FR_SIGNAL_CANCEL) request_done(request);
+       if (action == FR_SIGNAL_CANCEL) unlang_interpret_request_done(request);
 }
 
 /** Return the depth of the request's stack
@@ -933,6 +920,21 @@ bool unlang_interpret_is_resumable(request_t *request)
        return is_yielded(frame);
 }
 
+/** Indicate to the caller of the interpreter that this request is complete
+ *
+ */
+void unlang_interpret_request_done(request_t *request)
+{
+       unlang_stack_t          *stack = request->stack;
+       unlang_interpret_t      *intp = stack->intp;
+
+       if (request_is_internal(request)) {
+               intp->funcs.done_internal(request, stack->result, intp->uctx);
+       } else {
+               intp->funcs.done_external(request, stack->result, intp->uctx);
+       }
+}
+
 /** Mark a request as resumable.
  *
  * It's not called "unlang_interpret", because it doesn't actually
index 5d943e9b1dfc9fc7f6e9360b95bb38136ee61fe0..be18e826644853b1f246d35d4a7154aecd877595 100644 (file)
@@ -127,6 +127,8 @@ void                        *unlang_interpret_stack_alloc(TALLOC_CTX *ctx);
 
 bool                   unlang_request_is_scheduled(request_t const *request);
 
+void                   unlang_interpret_request_done(request_t *request);
+
 void                   unlang_interpret_mark_runnable(request_t *request);
 
 bool                   unlang_interpret_is_resumable(request_t *request);
index dd904d3ab32c0ae9b4cccae28d3fdc76d26fd9f2..85527f3074eedda15290df147de16870ffe90738 100644 (file)
@@ -153,7 +153,6 @@ static unlang_interpret_synchronous_t *unlang_interpret_synchronous_alloc(TALLOC
 rlm_rcode_t unlang_interpret_synchronous(request_t *request)
 {
        fr_event_list_t                 *old_el;
-       fr_heap_t                       *old_backlog;
        unlang_interpret_t              *old_intp;
        char const                      *caller;
 
@@ -166,12 +165,10 @@ rlm_rcode_t unlang_interpret_synchronous(request_t *request)
        int                             iterations = 0;
 
        old_el = request->el;
-       old_backlog = request->backlog;
        old_intp = unlang_interpret_get(request);
        caller = request->module;
 
        intps = unlang_interpret_synchronous_alloc(request, request->el);
-       request->backlog = intps->runnable;
        request->el = intps->el;
        unlang_interpret_set(request, intps->intp);
 
@@ -251,7 +248,6 @@ rlm_rcode_t unlang_interpret_synchronous(request_t *request)
        talloc_free(intps);
        unlang_interpret_set(request, old_intp);
        request->el = old_el;
-       request->backlog = old_backlog;
        request->module = caller;
 
        return rcode;
index 814f41259f9ccf5b633c1a6c006ca8789ff99ecd..a105deea3548efb92f7da9e48fb00a9721c43a90 100644 (file)
@@ -56,7 +56,7 @@ static inline CC_HINT(always_inline) void unlang_parallel_cancel_child(unlang_pa
                /*
                 *      Remove it from the runnable heap
                 */
-               (void)fr_heap_extract(child->parent->backlog, child);
+               unlang_interpret_request_done(child);
 
                /*
                 *      Free it.
@@ -308,27 +308,19 @@ static unlang_action_t unlang_parallel_process(rlm_rcode_t *p_result, request_t
                                if (!state->detach) {
                                        /*
                                         *      Remove the current child
+                                        *
+                                        *      Should also free detached children
                                         */
-                                       if (fr_heap_entry_inserted(child->runnable_id)) {
-                                               (void)fr_heap_extract(request->backlog, child);
-                                       }
-                                       talloc_free(child);
+                                       unlang_interpret_request_done(child);
 
                                        /*
                                         *      Remove all previously
                                         *      spawned children.
                                         */
-                                       for (--i; i >= 0; i--) {
-                                               child = state->children[i].request;
-                                               if (fr_heap_entry_inserted(child->runnable_id)) {
-                                                       (void)fr_heap_extract(request->backlog, child);
-                                               }
-                                               talloc_free(child);
-                                       }
+                                       for (--i; i >= 0; i--) unlang_interpret_request_done(child);
                                }
 
-                               *p_result = RLM_MODULE_FAIL;
-                               return UNLANG_ACTION_CALCULATE_RESULT;
+                               RETURN_MODULE_FAIL;
                        }
                }
 
@@ -357,8 +349,7 @@ static unlang_action_t unlang_parallel_process(rlm_rcode_t *p_result, request_t
                        if (unlang_subrequest_child_detach(child) < 0) {
                                talloc_free(child);
 
-                               *p_result = RLM_MODULE_FAIL;
-                               return UNLANG_ACTION_CALCULATE_RESULT;
+                               RETURN_MODULE_FAIL;
                        }
                /*
                 *      If the children don't start detached
index 7080ff92b3ba7eaa0e5c99226d60cd75f0bca71c..08abf336deb1e7b09941d6fe1c3267fa4eb06169 100644 (file)
@@ -467,7 +467,7 @@ static void request_queued(request_t *request, fr_state_signal_t action)
                break;
 
        case FR_SIGNAL_CANCEL:
-               (void) fr_heap_extract(request->backlog, request);
+//             (void) fr_heap_extract(request->backlog, request);
                //request_delete(request);
                break;