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.
#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.
* 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;
}
*/
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
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
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);
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;
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);
talloc_free(intps);
unlang_interpret_set(request, old_intp);
request->el = old_el;
- request->backlog = old_backlog;
request->module = caller;
return rcode;
/*
* Remove it from the runnable heap
*/
- (void)fr_heap_extract(child->parent->backlog, child);
+ unlang_interpret_request_done(child);
/*
* Free it.
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;
}
}
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
break;
case FR_SIGNAL_CANCEL:
- (void) fr_heap_extract(request->backlog, request);
+// (void) fr_heap_extract(request->backlog, request);
//request_delete(request);
break;