From: Arran Cudbard-Bell Date: Sat, 18 Mar 2023 04:37:20 +0000 (-0400) Subject: subrequest: Resume the parent if the child is cancelled X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=33d755ed788f13aaf180213571f9cee8ca0debec;p=thirdparty%2Ffreeradius-server.git subrequest: Resume the parent if the child is cancelled --- diff --git a/src/lib/unlang/subrequest_child.c b/src/lib/unlang/subrequest_child.c index 2b0ca4524c7..2186c7d7ad0 100644 --- a/src/lib/unlang/subrequest_child.c +++ b/src/lib/unlang/subrequest_child.c @@ -127,35 +127,44 @@ static void unlang_subrequest_child_signal(request_t *request, fr_state_signal_t { unlang_frame_state_subrequest_t *state; + if (!request->parent) return; + + state = talloc_get_type_abort(frame_current(request->parent)->state, unlang_frame_state_subrequest_t); + /* - * Ignore signals which aren't detach, + * Ignore signals which aren't detach, and ar * and ignore the signal if we have no parent. */ - if ((action != FR_SIGNAL_DETACH) || !request->parent) return; + switch (action) { + case FR_SIGNAL_DETACH: + /* + * Place child's state back inside the parent + */ + if (state->session.enable) fr_state_store_in_parent(request, + state->session.unique_ptr, + state->session.unique_int); + + if (!fr_cond_assert(unlang_subrequest_lifetime_set(request) == 0)) { + REDEBUG("Child could not be detached"); + return; + } + FALL_THROUGH; - state = talloc_get_type_abort(frame_current(request->parent), unlang_frame_state_subrequest_t); + case FR_SIGNAL_CANCEL: + /* + * Indicate to the parent there's no longer a child + */ + state->child = NULL; - /* - * Place child's state back inside the parent - */ - if (state->session.enable) fr_state_store_in_parent(request, - state->session.unique_ptr, - state->session.unique_int); + /* + * Tell the parent to resume + */ + unlang_interpret_mark_runnable(request->parent); + break; - if (!fr_cond_assert(unlang_subrequest_lifetime_set(request) == 0)) { - REDEBUG("Child could not be detached"); + default: return; } - - /* - * Indicate to the parent there's no longer a child - */ - state->child = NULL; - - /* - * Tell the parent to resume - */ - unlang_interpret_mark_runnable(request->parent); } /** When the child is done, tell the parent that we've exited.