mirror of
https://github.com/Links2004/arduinoWebSockets.git
synced 2025-07-25 13:27:13 +02:00
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.
This commit is contained in:
@ -625,6 +625,9 @@ bool WebSockets::readCb(WSclient_t * client, uint8_t * out, size_t n, WSreadWait
|
|||||||
if(!client->tcp->available()) {
|
if(!client->tcp->available()) {
|
||||||
#if(WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266)
|
#if(WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266)
|
||||||
delay(0);
|
delay(0);
|
||||||
|
#endif
|
||||||
|
#if(WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP32)
|
||||||
|
yield();
|
||||||
#endif
|
#endif
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user