mirror of
https://dev.iopsys.eu/bbf/bbfdm.git
synced 2026-03-14 21:20:28 +01:00
bbfdmd: complete deferred requests when async invoke setup fails
Issue: bbfdmd can defer a top-level ubus request and then never reply when a matching backend call fails before the async request is registered. Cause: The async fan-out path increments pending request state before calling ubus_invoke_async(). If that setup call fails, bbfdmd frees the tracker but leaves no in-flight request that can complete the deferred parent request. Fix: Mark matching services before launching backend calls, count only successfully started async requests as pending, and send an immediate deferred reply when no backend request was started.
This commit is contained in:
parent
12228596e3
commit
38b1ab0ea6
2 changed files with 3 additions and 3 deletions
|
|
@ -350,12 +350,13 @@ static int bbfdm_handler_async(struct ubus_context *ctx, struct ubus_object *obj
|
|||
if (!service_path_match(context->requested_path, requested_proto, service))
|
||||
continue;
|
||||
|
||||
context->path_matched = true;
|
||||
run_async_call(context, service, msg);
|
||||
}
|
||||
|
||||
context->service_list_processed = true;
|
||||
|
||||
if (context->path_matched == false)
|
||||
if (context->pending_requests == 0)
|
||||
send_response(context);
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -194,8 +194,6 @@ void run_async_call(struct async_request_context *ctx, service_entry_t *service,
|
|||
|
||||
tracker->ctx = ctx;
|
||||
tracker->service = service;
|
||||
ctx->pending_requests++;
|
||||
ctx->path_matched = true;
|
||||
|
||||
memset(&req_buf, 0, sizeof(struct blob_buf));
|
||||
blob_buf_init(&req_buf, 0);
|
||||
|
|
@ -220,6 +218,7 @@ void run_async_call(struct async_request_context *ctx, service_entry_t *service,
|
|||
uloop_timeout_cancel(&tracker->timeout);
|
||||
BBFDM_FREE(tracker);
|
||||
} else {
|
||||
ctx->pending_requests++;
|
||||
tracker->async_request.data_cb = ubus_result_callback;
|
||||
tracker->async_request.complete_cb = ubus_request_complete;
|
||||
ubus_complete_request_async(ctx->ubus_ctx, &tracker->async_request);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue