diff --git a/bbfdmd/ubus/bbfdmd.c b/bbfdmd/ubus/bbfdmd.c index b93aa2de..13d0f810 100644 --- a/bbfdmd/ubus/bbfdmd.c +++ b/bbfdmd/ubus/bbfdmd.c @@ -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; diff --git a/bbfdmd/ubus/get.c b/bbfdmd/ubus/get.c index 5cc78f3f..4ee55d0c 100644 --- a/bbfdmd/ubus/get.c +++ b/bbfdmd/ubus/get.c @@ -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);