From 5eaab80708552f2f2af00a7d81564e72a3efcac6 Mon Sep 17 00:00:00 2001 From: TerryZhang Date: Wed, 4 Mar 2020 12:51:47 +0000 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 bcbc6d54d..6f9ecc83c 100644 --- a/lib/core-net/output.c +++ b/lib/core-net/output.c @@ -170,6 +170,11 @@ int 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 */