diff options
author | José Bollo <jose.bollo@iot.bzh> | 2017-09-04 13:44:59 +0200 |
---|---|---|
committer | José Bollo <jose.bollo@iot.bzh> | 2017-09-07 09:43:13 +0200 |
commit | 36c7ab15e79d6b0ff6188b61da1061f36b902f8e (patch) | |
tree | 5f82f55b501ffb5fd512bd0e075c19c9f49980fc /src/afb-api-so-v1.c | |
parent | 1da7c5d76ee6abca43b83485adcd66d3a1ba55f8 (diff) |
afb-ditf: track daemon state
Change-Id: Ic21c79dcd9908919a1a8d13e8747ef0bd2490477
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/afb-api-so-v1.c')
-rw-r--r-- | src/afb-api-so-v1.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/afb-api-so-v1.c b/src/afb-api-so-v1.c index 2a5dc08a..a341dac3 100644 --- a/src/afb-api-so-v1.c +++ b/src/afb-api-so-v1.c @@ -88,7 +88,7 @@ static int service_start_cb(void *closure, int share_session, int onneed, struct if (desc->service != NULL) { /* not an error when onneed */ if (onneed != 0) - return 0; + goto done; /* already started: it is an error */ ERROR("Service %s already started", desc->binding->v1.prefix); @@ -101,7 +101,7 @@ static int service_start_cb(void *closure, int share_session, int onneed, struct if (init == NULL && onevent == NULL) { /* not an error when onneed */ if (onneed != 0) - return 0; + goto done; /* no initialisation method */ ERROR("Binding %s is not a service", desc->binding->v1.prefix); @@ -116,6 +116,7 @@ static int service_start_cb(void *closure, int share_session, int onneed, struct } /* Starts the service */ + desc->ditf.state = Daemon_Init; rc = afb_svc_start_v1(desc->service, init); if (rc < 0) { /* initialisation error */ @@ -125,6 +126,8 @@ static int service_start_cb(void *closure, int share_session, int onneed, struct return rc; } +done: + desc->ditf.state = Daemon_Run; return 0; } |