avoid flush on esp32, add/fix debugs, longer yield when waiting for data
flush causes a bunch of reads as we try to close the socket on esp32. I think flush is broken on that platform. the comments indicate confusion. added some debug logs for important cases that were missing them, some missing newlines to exisitng logs. added a longer yield when waiting for data, in some super busy cases it could trigger a task watchdog or otherwise starve the system. (yield alone doesn't always switch to lower priority tasks) make some other yields conditional to avoid some waste when it would double-yield.
This commit is contained in:
@@ -567,7 +567,7 @@ void WebSocketsServer::clientDisconnect(WSclient_t * client) {
|
||||
|
||||
if(client->tcp) {
|
||||
if(client->tcp->connected()) {
|
||||
#if(WEBSOCKETS_NETWORK_TYPE != NETWORK_ESP8266_ASYNC)
|
||||
#if(WEBSOCKETS_NETWORK_TYPE != NETWORK_ESP8266_ASYNC) && (WEBSOCKETS_NETWORK_TYPE != NETWORK_ESP32)
|
||||
client->tcp->flush();
|
||||
#endif
|
||||
client->tcp->stop();
|
||||
@@ -694,6 +694,7 @@ void WebSocketsServer::handleClientData(void) {
|
||||
WebSockets::handleWebsocket(client);
|
||||
break;
|
||||
default:
|
||||
DEBUG_WEBSOCKETS("[WS-Server][%d][handleClientData] unknown client status %d\n", client->num, client->status);
|
||||
WebSockets::clientDisconnect(client, 1002);
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user