kore

An easy to use, scalable and secure web application framework for writing web APIs in C.
Commits | Files | Refs | README | LICENSE | git clone https://git.kore.io/kore.git

commit 006f764d96e5d4e164e34fa2132c79081b423c57
parent 587a663f31f5f649529631b35aacfecf43fa9060
Author: Joris Vink <joris@coders.se>
Date:   Mon, 30 Jan 2017 22:35:34 +0100

when getting OP_CLOSE disable reads.

Diffstat:
src/websocket.c | 3+++
1 file changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/websocket.c b/src/websocket.c @@ -331,6 +331,7 @@ websocket_recv_frame(struct netbuf *nb) } break; case WEBSOCKET_OP_CLOSE: + c->flags &= ~CONN_READ_POSSIBLE; if (!(c->flags & CONN_WS_CLOSE_SENT)) { c->flags |= CONN_WS_CLOSE_SENT; kore_websocket_send(c, WEBSOCKET_OP_CLOSE, NULL, 0); @@ -347,6 +348,7 @@ websocket_recv_frame(struct netbuf *nb) } net_recv_reset(c, WEBSOCKET_FRAME_HDR, websocket_recv_opcode); + return (ret); } @@ -357,6 +359,7 @@ websocket_disconnect(struct connection *c) kore_runtime_wsdisconnect(c->ws_disconnect, c); if (!(c->flags & CONN_WS_CLOSE_SENT)) { + c->flags &= ~CONN_READ_POSSIBLE; c->flags |= CONN_WS_CLOSE_SENT; kore_websocket_send(c, WEBSOCKET_OP_CLOSE, NULL, 0); }