X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fafb-xreq.c;h=17a603c3c627fcaf55bd37a30cc5ce0f1effc8f9;hb=refs%2Fheads%2Fsandbox%2Fjobol%2Fwip;hp=f4756a9fc7b1e15de04069be1f664226a4c18db0;hpb=a2cf84ecde926adeebf09bc2c284401513d3fab3;p=src%2Fapp-framework-binder.git diff --git a/src/afb-xreq.c b/src/afb-xreq.c index f4756a9f..17a603c3 100644 --- a/src/afb-xreq.c +++ b/src/afb-xreq.c @@ -202,12 +202,15 @@ static int xreq_legacy_subscribe_event_x1_cb(struct afb_req_x2 *closure, struct int afb_xreq_subscribe(struct afb_xreq *xreq, struct afb_event_x2 *event) { - if (xreq->listener) - return afb_evt_event_x2_add_watch(xreq->listener, event); - if (xreq->queryitf->subscribe) - return xreq->queryitf->subscribe(xreq, event); - ERROR("no event listener, subscription impossible"); - errno = EINVAL; + if (xreq->replied) { + ERROR("request replied, subscription impossible"); + errno = EINVAL; + } else { + if (xreq->queryitf->subscribe) + return xreq->queryitf->subscribe(xreq, event); + ERROR("no event listener, subscription impossible"); + errno = ENOTSUP; + } return -1; } @@ -224,12 +227,15 @@ static int xreq_legacy_unsubscribe_event_x1_cb(struct afb_req_x2 *closure, struc int afb_xreq_unsubscribe(struct afb_xreq *xreq, struct afb_event_x2 *event) { - if (xreq->listener) - return afb_evt_event_x2_remove_watch(xreq->listener, event); - if (xreq->queryitf->unsubscribe) - return xreq->queryitf->unsubscribe(xreq, event); - ERROR("no event listener, unsubscription impossible"); - errno = EINVAL; + if (xreq->replied) { + ERROR("request replied, unsubscription impossible"); + errno = EINVAL; + } else { + if (xreq->queryitf->unsubscribe) + return xreq->queryitf->unsubscribe(xreq, event); + ERROR("no event listener, unsubscription impossible"); + errno = ENOTSUP; + } return -1; } @@ -722,6 +728,7 @@ int afb_xreq_legacy_subcall_sync(struct afb_xreq *xreq, const char *api, const c return afb_req_x2_subcall_sync_legacy(xreq_to_req_x2(xreq), api, verb, args, result); } +#if WITH_LEGACY_BINDING_V1 static int xreq_session_check_apply_v1(struct afb_xreq *xreq, int sessionflags) { int loa; @@ -763,6 +770,7 @@ static int xreq_session_check_apply_v1(struct afb_xreq *xreq, int sessionflags) return 0; } +#endif static int xreq_session_check_apply_v2(struct afb_xreq *xreq, uint32_t sessionflags, const struct afb_auth *auth) { @@ -800,6 +808,7 @@ static int xreq_session_check_apply_v2(struct afb_xreq *xreq, uint32_t sessionfl return 0; } +#if WITH_LEGACY_BINDING_V1 void afb_xreq_call_verb_v1(struct afb_xreq *xreq, const struct afb_verb_desc_v1 *verb) { if (!verb) @@ -808,7 +817,9 @@ void afb_xreq_call_verb_v1(struct afb_xreq *xreq, const struct afb_verb_desc_v1 if (!xreq_session_check_apply_v1(xreq, verb->session)) verb->callback(xreq_to_req_x1(xreq)); } +#endif +#if WITH_LEGACY_BINDING_V2 void afb_xreq_call_verb_v2(struct afb_xreq *xreq, const struct afb_verb_v2 *verb) { if (!verb) @@ -817,6 +828,7 @@ void afb_xreq_call_verb_v2(struct afb_xreq *xreq, const struct afb_verb_v2 *verb if (!xreq_session_check_apply_v2(xreq, verb->session, verb->auth)) verb->callback(xreq_to_req_x1(xreq)); } +#endif void afb_xreq_call_verb_v3(struct afb_xreq *xreq, const struct afb_verb_v3 *verb) {