From: Arran Cudbard-Bell Date: Tue, 30 Mar 2021 10:22:22 +0000 (+0100) Subject: Remove request->backlog X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1a309486bc47ccf41be65ceadb49cd69ca020990;p=thirdparty%2Ffreeradius-server.git Remove request->backlog --- diff --git a/src/lib/server/request.h b/src/lib/server/request.h index bf30e174c6e..bb1520d7f8d 100644 --- a/src/lib/server/request.h +++ b/src/lib/server/request.h @@ -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. diff --git a/src/lib/unlang/interpret.c b/src/lib/unlang/interpret.c index 9fe02ce9742..594bb1eedf0 100644 --- a/src/lib/unlang/interpret.c +++ b/src/lib/unlang/interpret.c @@ -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 diff --git a/src/lib/unlang/interpret.h b/src/lib/unlang/interpret.h index 5d943e9b1df..be18e826644 100644 --- a/src/lib/unlang/interpret.h +++ b/src/lib/unlang/interpret.h @@ -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); diff --git a/src/lib/unlang/interpret_synchronous.c b/src/lib/unlang/interpret_synchronous.c index dd904d3ab32..85527f3074e 100644 --- a/src/lib/unlang/interpret_synchronous.c +++ b/src/lib/unlang/interpret_synchronous.c @@ -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; diff --git a/src/lib/unlang/parallel.c b/src/lib/unlang/parallel.c index 814f41259f9..a105deea354 100644 --- a/src/lib/unlang/parallel.c +++ b/src/lib/unlang/parallel.c @@ -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 diff --git a/src/modules/proto_ldap_sync/proto_ldap_sync.c b/src/modules/proto_ldap_sync/proto_ldap_sync.c index 7080ff92b3b..08abf336deb 100644 --- a/src/modules/proto_ldap_sync/proto_ldap_sync.c +++ b/src/modules/proto_ldap_sync/proto_ldap_sync.c @@ -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;