From eb9c01ae5c51ff7ca5713270c695eb67f20174de Mon Sep 17 00:00:00 2001 From: Terry Zhang Date: Wed, 4 Mar 2020 17:39:11 +0800 Subject: [PATCH] ws: make sure we understand frame finished when buflist_out flushed When lws_write as many bytes as user can until function returns not all sent, the next user`s lws_write call will write wrong frame to the other end. This will cause connection be close by the other side. --- lib/core-net/output.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/core-net/output.c b/lib/core-net/output.c index 83b8f9a4e..0865bf1e9 100644 --- a/lib/core-net/output.c +++ b/lib/core-net/output.c @@ -172,6 +172,11 @@ lws_issue_raw(struct lws *wsi, unsigned char *buf, size_t len) -1 : (int)real_len; } #endif +#endif +#if defined(LWS_ROLE_WS) + /* Since buflist_out flushed, we're not inside a frame any more */ + if (wsi->ws) + wsi->ws->inside_frame = 0; #endif } /* always callback on writeable */