RDEBUG3("parallel - child %s (%d/%d) INIT",
child->name,
i + 1, state->num_children);
+ state->children[i].name = talloc_bstrdup(state, child->name);
if (state->detach) child_free = child;
case CHILD_RUNNABLE:
runnable:
RDEBUG2("parallel - child %s (%d/%d) continuing",
- state->children[i].child->name,
+ state->children[i].name,
i + 1, state->num_children);
/*
}
RDEBUG3("parallel - child %s (%d/%d) returns %s",
- state->children[i].child->name,
+ state->children[i].name,
i + 1, state->num_children,
fr_table_str_by_value(mod_rcode_table, result, "<invalid>"));
*/
if (priority == MOD_ACTION_RETURN) {
RDEBUG2("parallel - child %s (%d/%d) says 'return' - skipping the remaining children",
- state->children[i].child->name,
+ state->children[i].name,
i + 1, state->num_children);
/*
fr_assert(state->children[i].instruction != NULL);
RDEBUG3("parallel - child %s (%d/%d) YIELDED",
- state->children[i].child->name,
+ state->children[i].name,
i + 1, state->num_children);
child_state = CHILD_YIELDED;
continue;
case CHILD_EXITED:
RDEBUG3("parallel - child %s (%d/%d) EXITED",
- state->children[i].child->name,
+ state->children[i].name,
i + 1, state->num_children);
state->children[i].state = CHILD_DONE;
state->children[i].child = NULL; // someone else freed this somewhere
*/
case CHILD_DONE:
RDEBUG3("parallel - child %s (%d/%d) DONE",
- state->children[i].child->name,
+ state->children[i].name,
i + 1, state->num_children);
fr_assert(state->children[i].child == NULL);
fr_assert(state->children[i].instruction == NULL);
/*
* Allocate an array for the children.
*/
- frame->state = state = talloc_zero_size(request,
- sizeof(unlang_parallel_state_t) +
- sizeof(state->children[0]) *
- g->num_children);
+ MEM(frame->state = state = _talloc_zero_pooled_object(request,
+ sizeof(unlang_parallel_state_t) +
+ (sizeof(state->children[0]) * g->num_children),
+ "unlang_parallel_state_t",
+ g->num_children,
+ (talloc_array_length(request->name) * 2)));
if (!state) {
*p_result = RLM_MODULE_FAIL;
return UNLANG_ACTION_CALCULATE_RESULT;
*/
typedef struct {
unlang_parallel_child_state_t state; //!< State of the child.
- request_t *child; //!< Child request.
+ request_t *child; //!< Child request.
+ char *name; //!< Cache the request name.
unlang_t *instruction; //!< broken out of g->children
} unlang_parallel_child_t;
typedef struct {
- rlm_rcode_t result;
- int priority;
+ rlm_rcode_t result;
+ int priority;
- int num_children; //!< How many children are executing.
+ int num_children; //!< How many children are executing.
- bool detach; //!< are we creating the child detached
- bool clone; //!< are the children cloned
+ bool detach; //!< are we creating the child detached
+ bool clone; //!< are the children cloned
- unlang_parallel_child_t children[]; //!< Array of children.
+ unlang_parallel_child_t children[]; //!< Array of children.
} unlang_parallel_state_t;
typedef struct {
- unlang_group_t group;
- bool detach; //!< are we creating the child detached
- bool clone;
+ unlang_group_t group;
+ bool detach; //!< are we creating the child detached
+ bool clone;
} unlang_parallel_t;
/** Cast a group structure to the parallel keyword extension