summaryrefslogtreecommitdiffstats
path: root/src/afb-xreq.c
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2017-06-01 19:23:28 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2017-06-01 22:13:07 +0200
commit9b2c70bf87bb3272cb325f3a9ecf69cd0bd53ba8 (patch)
tree7b9857812d5ecb70ab1f90b46ad98f986ede9f74 /src/afb-xreq.c
parentec0a2d0f6b22750931fddfd6511219bcccd3c4f9 (diff)
Enforce starting services on need
Also remove default api verbs because it wasn't used actually and it wasn't compatible with this evolution. Change-Id: I863b99eddd418f771011bb35b4bcea763046224e Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/afb-xreq.c')
-rw-r--r--src/afb-xreq.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/afb-xreq.c b/src/afb-xreq.c
index ba533c90..e8a42226 100644
--- a/src/afb-xreq.c
+++ b/src/afb-xreq.c
@@ -664,8 +664,11 @@ static void process_sync(struct afb_xreq *xreq)
afb_hook_xreq_begin(xreq);
/* search the api */
- if (afb_apiset_get(xreq->apiset, xreq->api, &api) < 0) {
- afb_xreq_fail_f(xreq, "unknown-api", "api %s not found", xreq->api);
+ if (afb_apiset_get_started(xreq->apiset, xreq->api, &api) < 0) {
+ if (errno == ENOENT)
+ afb_xreq_fail_f(xreq, "unknown-api", "api %s not found", xreq->api);
+ else
+ afb_xreq_fail_f(xreq, "bad-api-state", "api %s not started correctly: %m", xreq->api);
} else {
xreq->context.api_key = api.closure;
api.itf->call(api.closure, xreq);