From ebd7a528ac737eeb2dc736c073ce834e9b7fa556 Mon Sep 17 00:00:00 2001 From: Ben Hencke Date: Sat, 15 Feb 2020 06:43:46 -0800 Subject: [PATCH] add a yield here for esp32 to avoid a busy loop if data isn't available yet, but is expected, yielding here is nicer than burning the cpu in a loop, just like in esp8266 case. --- src/WebSockets.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/WebSockets.cpp b/src/WebSockets.cpp index a3ada67..21d3ef8 100644 --- a/src/WebSockets.cpp +++ b/src/WebSockets.cpp @@ -625,6 +625,9 @@ bool WebSockets::readCb(WSclient_t * client, uint8_t * out, size_t n, WSreadWait if(!client->tcp->available()) { #if(WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266) delay(0); +#endif +#if(WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP32) + yield(); #endif continue; }