diff options
author | José Bollo <jose.bollo@iot.bzh> | 2017-08-30 16:54:58 +0200 |
---|---|---|
committer | José Bollo <jose.bollo@iot.bzh> | 2017-08-30 16:54:58 +0200 |
commit | a221b08b008c3e3e63dccdbccbcdb7fe8aeb3481 (patch) | |
tree | 01b923f2df19e56310320d2bfc8eef7da65dd9fd | |
parent | 4d0e21f182078923c318bf15397fe4c980989aea (diff) |
afb-api-ws: check that the ws-server API exist
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
-rw-r--r-- | src/afb-api-ws.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/afb-api-ws.c b/src/afb-api-ws.c index 07c8202f..dffe1267 100644 --- a/src/afb-api-ws.c +++ b/src/afb-api-ws.c @@ -318,12 +318,19 @@ int afb_api_ws_add_server(const char *path, struct afb_apiset *apiset) { int rc; struct api_ws *apiws; + struct afb_api api; /* creates the ws api object */ apiws = api_ws_make(path); if (apiws == NULL) goto error; + /* check api name */ + if (afb_apiset_get(apiset, apiws->api, &api)) { + ERROR("Can't provide ws-server for %s: API %s doesn't exist", path, apiws->api); + goto error2; + } + /* connect for serving */ rc = api_ws_server_connect(apiws); if (rc < 0) |