X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fafb-ws.c;h=66d1e8d153d1642c4d2559f8cc0bd11f808ebfd0;hb=04b1757467bcb4e287dd1c34d5a21f76705340d6;hp=49a314a60698269e67b319452c30d9331af42c05;hpb=94ad734842c1359a012f9850b851063637d3e061;p=src%2Fapp-framework-binder.git diff --git a/src/afb-ws.c b/src/afb-ws.c index 49a314a6..66d1e8d1 100644 --- a/src/afb-ws.c +++ b/src/afb-ws.c @@ -31,7 +31,6 @@ static ssize_t aws_writev(struct afb_ws *ws, const struct iovec *iov, int iovcnt); static ssize_t aws_readv(struct afb_ws *ws, const struct iovec *iov, int iovcnt); -static void aws_disconnect(struct afb_ws *ws); static void aws_on_close(struct afb_ws *ws, uint16_t code, size_t size); static void aws_on_text(struct afb_ws *ws, int last, size_t size); static void aws_on_binary(struct afb_ws *ws, int last, size_t size); @@ -42,7 +41,6 @@ static void aws_on_hangup(struct afb_ws *ws); static struct websock_itf aws_itf = { .writev = (void*)aws_writev, .readv = (void*)aws_readv, - .disconnect = (void*)aws_disconnect, .on_ping = NULL, .on_pong = NULL, @@ -122,17 +120,17 @@ void afb_ws_disconnect(struct afb_ws *ws) void afb_ws_close(struct afb_ws *ws, uint16_t code) { - websock_close_code(ws->ws, code); + websock_close_code(ws->ws, code, NULL, 0); } void afb_ws_text(struct afb_ws *ws, const char *text, size_t length) { - websock_text(ws->ws, text, length); + websock_text(ws->ws, 1, text, length); } void afb_ws_binary(struct afb_ws *ws, const void *data, size_t length) { - websock_binary(ws->ws, data, length); + websock_binary(ws->ws, 1, data, length); } static ssize_t aws_writev(struct afb_ws *ws, const struct iovec *iov, int iovcnt) @@ -163,11 +161,6 @@ static void aws_on_hangup(struct afb_ws *ws) afb_ws_disconnect(ws); } -static void aws_disconnect(struct afb_ws *ws) -{ - afb_ws_disconnect(ws); -} - static inline struct buf aws_pick_buffer(struct afb_ws *ws) { struct buf result = ws->buffer; @@ -212,10 +205,10 @@ static void aws_on_text(struct afb_ws *ws, int last, size_t size) { if (ws->type != none) { websock_drop(ws->ws); - websock_close_code(ws->ws, WEBSOCKET_CODE_PROTOCOL_ERROR); + websock_close_code(ws->ws, WEBSOCKET_CODE_PROTOCOL_ERROR, NULL, 0); } else if (ws->itf->on_text == NULL) { websock_drop(ws->ws); - websock_close_code(ws->ws, WEBSOCKET_CODE_CANT_ACCEPT); + websock_close_code(ws->ws, WEBSOCKET_CODE_CANT_ACCEPT, NULL, 0); } else { ws->type = text; aws_on_continue(ws, last, size); @@ -226,10 +219,10 @@ static void aws_on_binary(struct afb_ws *ws, int last, size_t size) { if (ws->type != none) { websock_drop(ws->ws); - websock_close_code(ws->ws, WEBSOCKET_CODE_PROTOCOL_ERROR); + websock_close_code(ws->ws, WEBSOCKET_CODE_PROTOCOL_ERROR, NULL, 0); } else if (ws->itf->on_binary == NULL) { websock_drop(ws->ws); - websock_close_code(ws->ws, WEBSOCKET_CODE_CANT_ACCEPT); + websock_close_code(ws->ws, WEBSOCKET_CODE_CANT_ACCEPT, NULL, 0); } else { ws->type = text; aws_on_continue(ws, last, size); @@ -243,7 +236,7 @@ static void aws_on_continue(struct afb_ws *ws, int last, size_t size) if (ws->type == none) { websock_drop(ws->ws); - websock_close_code(ws->ws, WEBSOCKET_CODE_PROTOCOL_ERROR); + websock_close_code(ws->ws, WEBSOCKET_CODE_PROTOCOL_ERROR, NULL, 0); } else { if (!aws_read(ws, size)) { aws_on_close(ws, WEBSOCKET_CODE_ABNORMAL, 0);