X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fwebsock.c;h=f79feb5ec36d733de4a03bedececa275b0fe9a2c;hb=d69860c79a93845b78bbeafafbf04d12c60e63fa;hp=e899ee52062dfea5d3ebb212a330f11d94b8de7d;hpb=dd1e45095d0525384a3600b8a4532046d35befac;p=src%2Fapp-framework-binder.git diff --git a/src/websock.c b/src/websock.c index e899ee52..f79feb5e 100644 --- a/src/websock.c +++ b/src/websock.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 "IoT.bzh" + * Copyright (C) 2016, 2017 "IoT.bzh" * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -303,7 +303,7 @@ static int check_control_header(struct websock *ws) return 1; } -int websock_dispatch(struct websock *ws) +int websock_dispatch(struct websock *ws, int loop) { uint16_t code; loop: @@ -418,16 +418,22 @@ loop: ws->itf->on_continue(ws->closure, FRAME_GET_FIN(ws->header[0]), (size_t) ws->length); + if (!loop) + return 0; break; case OPCODE_TEXT: ws->itf->on_text(ws->closure, FRAME_GET_FIN(ws->header[0]), (size_t) ws->length); + if (!loop) + return 0; break; case OPCODE_BINARY: ws->itf->on_binary(ws->closure, FRAME_GET_FIN(ws->header[0]), (size_t) ws->length); + if (!loop) + return 0; break; case OPCODE_CLOSE: if (ws->length == 0) @@ -447,6 +453,8 @@ loop: websock_pong(ws, NULL, 0); } ws->state = STATE_INIT; + if (!loop) + return 0; break; case OPCODE_PONG: if (ws->itf->on_pong) @@ -454,6 +462,8 @@ loop: else websock_drop(ws); ws->state = STATE_INIT; + if (!loop) + return 0; break; default: goto protocol_error;