X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fafb-api-ws.c;h=7e0adb7ef5a3bf0a9a60bf159db78d47cf03b70e;hb=6634329b7a1a94aa1555649b933010fb9fcd0381;hp=dba8d05b446ff0d9ce6f2be123f24dafe9a1e10f;hpb=69d7968b9713dafa23268ee34516e50133ca8b36;p=src%2Fapp-framework-binder.git diff --git a/src/afb-api-ws.c b/src/afb-api-ws.c index dba8d05b..7e0adb7e 100644 --- a/src/afb-api-ws.c +++ b/src/afb-api-ws.c @@ -169,7 +169,6 @@ static int api_ws_socket_inet(const char *path, int server) } freeaddrinfo(rai); return -1; - } static int api_ws_socket(const char *path, int server) @@ -226,9 +225,14 @@ int afb_api_ws_add_client(const char *path, struct afb_apiset *apiset) ERROR("can't setup client ws service to %s", apiws->path); goto error3; } + if (afb_stub_ws_client_add(stubws, apiset) < 0) { + ERROR("can't add the client to the apiset for service %s", apiws->path); + goto error4; + } free(apiws); return 0; - +error4: + afb_stub_ws_unref(stubws); error3: close(apiws->fd); error2: @@ -319,6 +323,12 @@ int afb_api_ws_add_server(const char *path, struct afb_apiset *apiset) if (apiws == NULL) goto error; + /* check api name */ + if (!afb_apiset_lookup(apiset, apiws->api, 1)) { + 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)