From 773efb074585b8001eeb68807840c3194fca9951 Mon Sep 17 00:00:00 2001 From: Sergey Lyubka Date: Wed, 1 Apr 2015 18:37:13 +0100 Subject: [PATCH] Respect WEBSOCKET_OPCODE_CONNECTION_CLOSE coming from client --- mongoose.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mongoose.c b/mongoose.c index 43e818a1..2b85e238 100644 --- a/mongoose.c +++ b/mongoose.c @@ -3032,7 +3032,8 @@ static size_t deliver_websocket_frame(struct connection *conn) { } // Call the handler and remove frame from the iobuf - if (call_user(conn, MG_REQUEST) == MG_FALSE) { + if (call_user(conn, MG_REQUEST) == MG_FALSE || + (buf[0] & 0x0f) == WEBSOCKET_OPCODE_CONNECTION_CLOSE) { conn->ns_conn->flags |= NSF_FINISHED_SENDING_DATA; } iobuf_remove(&conn->ns_conn->recv_iobuf, frame_len);