From 9f7925b1a87daa182a1d77a0b4db603099970374 Mon Sep 17 00:00:00 2001 From: OlivierHecart Date: Fri, 15 Mar 2024 16:57:34 +0100 Subject: [PATCH] Fix bug reading from ws (#370) --- src/system/emscripten/network.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/system/emscripten/network.c b/src/system/emscripten/network.c index 95c0d2f09..4db1dadb3 100644 --- a/src/system/emscripten/network.c +++ b/src/system/emscripten/network.c @@ -116,9 +116,8 @@ size_t _z_read_ws(const _z_sys_net_socket_t sock, uint8_t *ptr, size_t len) { z_sleep_ms(WS_LINK_SLEEP); // WARNING: workaround need to give the hand to the emscripten threads rb = recv(sock._ws._fd, ptr, len, 0); } - // WARNING: workaround as the recv returns -1 not only in case of errors if (rb < 0) { - rb = 0; + rb = SIZE_MAX; } return rb; }