X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fafb-websock.c;h=885b986a4a5c25b21f1deef7b0a199dca3fe05cf;hb=ce7b0d0a381016057cedb99f1e33293c9f65b562;hp=878df0425e8fe3b443077b2c37cbf8322ca14918;hpb=83ce3b29a598141f8f28afde655beb07ec78c312;p=src%2Fapp-framework-binder.git diff --git a/src/afb-websock.c b/src/afb-websock.c index 878df042..885b986a 100644 --- a/src/afb-websock.c +++ b/src/afb-websock.c @@ -2,8 +2,6 @@ * Copyright 2016 IoT.bzh * Author: José Bollo * - * Inspired by the work of - * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -170,7 +168,8 @@ static struct websock_itf aws_itf = { .on_close = (void*)aws_on_close, .on_text = (void*)aws_on_content, .on_binary = (void*)aws_on_content, - .on_continue = (void*)aws_on_content + .on_continue = (void*)aws_on_content, + .on_extension = NULL }; struct afb_wsreq @@ -235,23 +234,25 @@ struct afb_websock *afb_websock_create(struct afb_hreq *hreq) result->tokener = json_tokener_new(); if (result->tokener == NULL) - goto error2; + goto error3; - result->ws = websock_create(&aws_itf, result); + result->ws = websock_create_v13(&aws_itf, result); if (result->ws == NULL) - goto error3; + goto error4; result->up = upoll_open(result->fd, result); if (result->up == NULL) - goto error4; + goto error5; upoll_on_readable(result->up, (void*)aws_on_readable); upoll_on_hangup(result->up, (void*)aws_disconnect); return result; -error4: +error5: websock_destroy(result->ws); -error3: +error4: json_tokener_free(result->tokener); +error3: + ctxClientPut(result->context); error2: free(result); error: @@ -301,7 +302,7 @@ static void aws_on_readable(struct afb_websock *ws) static int aws_handle_json(struct afb_websock *aws, struct json_object *obj) { struct afb_req r; - int count, num, rc; + int count, num; struct json_object *type, *id, *name, *req, *token; struct afb_wsreq *wsreq; const char *api, *verb; @@ -403,7 +404,6 @@ static void aws_on_content(struct afb_websock *ws, int last, size_t size) } } - static struct afb_arg wsreq_get(struct afb_wsreq *wsreq, const char *name) { struct afb_arg arg;