X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fafb-stub-ws.c;h=b362c127a6cbfaa06cd9e1c8b9c18e7286093468;hb=5425e054fbf87fe6d024103f46e53f2a28e074f2;hp=5dfacb731faf76af714882cb9caa1eb6617cae77;hpb=9295a52e5ea920a969aa0bf7aedd2342fb59c8fe;p=src%2Fapp-framework-binder.git diff --git a/src/afb-stub-ws.c b/src/afb-stub-ws.c index 5dfacb73..b362c127 100644 --- a/src/afb-stub-ws.c +++ b/src/afb-stub-ws.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015-2018 "IoT.bzh" + * Copyright (C) 2015-2019 "IoT.bzh" * Author José Bollo * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -266,6 +266,7 @@ static void client_api_call_cb(void * closure, struct afb_xreq *xreq) return; } + afb_xreq_unhooked_addref(xreq); rc = afb_proto_ws_client_call( proto, xreq->request.called_verb, @@ -273,10 +274,10 @@ static void client_api_call_cb(void * closure, struct afb_xreq *xreq) afb_session_uuid(xreq->context.session), xreq, xreq_on_behalf_cred_export(xreq)); - if (rc >= 0) - afb_xreq_unhooked_addref(xreq); - else + if (rc < 0) { afb_xreq_reply(xreq, NULL, "internal", "can't send message"); + afb_xreq_unhooked_unref(xreq); + } } static void client_on_description_cb(void *closure, struct json_object *data) @@ -646,9 +647,9 @@ static void on_hangup(void *closure) } } -static int enqueue_processing(void (*callback)(int signum, void* arg), void *arg) +static int enqueue_processing(struct afb_proto_ws *proto, void (*callback)(int signum, void* arg), void *arg) { - return jobs_queue(NULL, 0, callback, arg); + return jobs_queue(NULL /* proto */, 0, callback, arg); } /*****************************************************/