X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fafb-xreq.c;h=7621b8017c1d6f9f06d0afce1ce30e3c716b2d10;hb=d735ff81293a2de1860a99afef891ac3fc6c1c09;hp=8cc22c3f8630943ddccc4e5c67a255b081ce226f;hpb=ec0564bc90b3c63f7e82f09e81db8bd2cfac89a2;p=src%2Fapp-framework-binder.git diff --git a/src/afb-xreq.c b/src/afb-xreq.c index 8cc22c3f..7621b801 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; } @@ -314,7 +320,7 @@ static struct json_object *xreq_get_client_info_cb(struct afb_req_x2 *closure) json_object_object_add(r, "id", json_object_new_string(xreq->cred->id)); } if (xreq->context.session) { - json_object_object_add(r, "uuid", json_object_new_string(afb_context_uuid(&xreq->context))); + json_object_object_add(r, "uuid", json_object_new_string(afb_context_uuid(&xreq->context)?:"")); json_object_object_add(r, "LOA", json_object_new_int(afb_context_get_loa(&xreq->context))); } return r; @@ -754,9 +760,6 @@ static int xreq_session_check_apply_v1(struct afb_xreq *xreq, int sessionflags) } } - if ((sessionflags & AFB_SESSION_RENEW_X1) != 0) { - afb_context_refresh(&xreq->context); - } if ((sessionflags & AFB_SESSION_CLOSE_X1) != 0) { afb_context_change_loa(&xreq->context, 0); afb_context_close(&xreq->context); @@ -792,9 +795,6 @@ static int xreq_session_check_apply_v2(struct afb_xreq *xreq, uint32_t sessionfl return -1; } - if ((sessionflags & AFB_SESSION_REFRESH_X2) != 0) { - afb_context_refresh(&xreq->context); - } if ((sessionflags & AFB_SESSION_CLOSE_X2) != 0) { afb_context_close(&xreq->context); }