X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fafb-ws-json1.c;h=8309065dd4bdadf9791b28812e1cb52b85aafd3e;hb=3bf52bb36ed428d0a7b947519fbccc7c376fd4a9;hp=9d295e7806bf1613a276d983f6ed4b44fb4444fd;hpb=d8ef25780bffa6f91f013ef71b1ede908325e59d;p=src%2Fapp-framework-binder.git diff --git a/src/afb-ws-json1.c b/src/afb-ws-json1.c index 9d295e78..8309065d 100644 --- a/src/afb-ws-json1.c +++ b/src/afb-ws-json1.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 "IoT.bzh" + * Copyright (C) 2016, 2017 "IoT.bzh" * Author: José Bollo * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -29,8 +29,9 @@ #include "afb-wsj1.h" #include "afb-ws-json1.h" +#include "afb-common.h" #include "afb-msg-json.h" -#include "session.h" +#include "afb-session.h" #include "afb-apis.h" #include "afb-context.h" #include "afb-evt.h" @@ -65,7 +66,7 @@ struct afb_ws_json1 int refcount; void (*cleanup)(void*); void *cleanup_closure; - struct AFB_clientCtx *session; + struct afb_session *session; struct afb_evt_listener *listener; struct afb_wsj1 *wsj1; int new_session; @@ -138,12 +139,12 @@ struct afb_ws_json1 *afb_ws_json1_create(int fd, struct afb_context *context, vo result->refcount = 1; result->cleanup = cleanup; result->cleanup_closure = cleanup_closure; - result->session = ctxClientAddRef(context->session); + result->session = afb_session_addref(context->session); result->new_session = context->created != 0; if (result->session == NULL) goto error2; - result->wsj1 = afb_wsj1_create(fd, &wsj1_itf, result); + result->wsj1 = afb_wsj1_create(afb_common_get_event_loop(), fd, &wsj1_itf, result); if (result->wsj1 == NULL) goto error3; @@ -156,7 +157,7 @@ struct afb_ws_json1 *afb_ws_json1_create(int fd, struct afb_context *context, vo error4: afb_wsj1_unref(result->wsj1); error3: - ctxClientUnref(result->session); + afb_session_unref(result->session); error2: free(result); error: @@ -177,7 +178,7 @@ static void aws_unref(struct afb_ws_json1 *ws) afb_wsj1_unref(ws->wsj1); if (ws->cleanup != NULL) ws->cleanup(ws->cleanup_closure); - ctxClientUnref(ws->session); + afb_session_unref(ws->session); free(ws); } } @@ -219,7 +220,7 @@ static void aws_on_call(struct afb_ws_json1 *ws, const char *api, const char *ve /* emits the call */ r.closure = wsreq; r.itf = &afb_ws_json1_req_itf; - afb_apis_call_(r, &wsreq->context, api, verb); + afb_apis_call(r, &wsreq->context, api, verb); wsreq_unref(wsreq); }