X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=src%2Fafb-ws-json1.c;h=fec411731b1ce5f0665031f51ef71d8464a51b47;hb=a05138e6bf1257b0e7b1ad90c974fb9e12f1d040;hp=29078e26193ad06cfd66b18265e5c2af370159df;hpb=0b838a6101edc810098ee0645d3bfd966096ae07;p=src%2Fapp-framework-binder.git diff --git a/src/afb-ws-json1.c b/src/afb-ws-json1.c index 29078e26..fec41173 100644 --- a/src/afb-ws-json1.c +++ b/src/afb-ws-json1.c @@ -32,6 +32,7 @@ #include "afb-common.h" #include "afb-msg-json.h" #include "afb-session.h" +#include "afb-cred.h" #include "afb-apis.h" #include "afb-xreq.h" #include "afb-context.h" @@ -62,6 +63,7 @@ struct afb_ws_json1 struct afb_session *session; struct afb_evt_listener *listener; struct afb_wsj1 *wsj1; + struct afb_cred *cred; int new_session; }; @@ -128,6 +130,7 @@ struct afb_ws_json1 *afb_ws_json1_create(int fd, struct afb_context *context, vo if (result->listener == NULL) goto error4; + result->cred = afb_cred_create_for_socket(fd); return result; error4: @@ -155,6 +158,7 @@ static void aws_unref(struct afb_ws_json1 *ws) if (ws->cleanup != NULL) ws->cleanup(ws->cleanup_closure); afb_session_unref(ws->session); + afb_cred_unref(ws->cred); free(ws); } } @@ -231,9 +235,10 @@ static struct json_object *wsreq_json(struct afb_wsreq *wsreq) static void wsreq_reply(struct afb_wsreq *wsreq, int iserror, json_object *obj) { int rc; + rc = (iserror ? afb_wsj1_reply_error_j : afb_wsj1_reply_ok_j)( wsreq->msgj1, obj, afb_context_sent_token(&wsreq->xreq.context)); if (rc) - ERROR("Can't send reply: %m (was %s)", json_object_get_string(obj)); + ERROR("Can't send reply: %m"); }