sendLiveLedsWs: don't kick clients

... on low memory conditions, as a lot of UI communication depends on web-sockets (thanks @ewoudwijma for pointing this out).
This commit is contained in:
Frank
2023-06-04 17:11:26 +02:00
committed by GitHub
parent 35f3f2859a
commit 4d64efa5cb

View File

@@ -197,9 +197,9 @@ static bool sendLiveLedsWs(uint32_t wsClient) // WLEDMM added "static"
if (wsBuf == nullptr) { // 8266 does not support exceptions if (wsBuf == nullptr) { // 8266 does not support exceptions
#endif #endif
wsBuf = nullptr; wsBuf = nullptr;
DEBUG_PRINTLN(F("WS buffer allocation failed, dropping connections.")); DEBUG_PRINTLN(F("WS buffer allocation failed."));
ws.closeAll(1013); //code 1013 = temporary overload, try again later //ws.closeAll(1013); //code 1013 = temporary overload, try again later
ws.cleanupClients(0); //disconnect all clients to release memory //ws.cleanupClients(0); //disconnect all clients to release memory
ws._cleanBuffers(); ws._cleanBuffers();
} }
@@ -213,7 +213,7 @@ static bool sendLiveLedsWs(uint32_t wsClient) // WLEDMM added "static"
#ifndef WLED_DISABLE_2D #ifndef WLED_DISABLE_2D
if (strip.isMatrix) { if (strip.isMatrix) {
buffer[1] = 2; //version buffer[1] = 2; //version
buffer[2] = min(Segment::maxWidth, (uint16_t) 255); // WLEDMM prevent overflow buffer[2] = min(Segment::maxWidth, (uint16_t) 255); // WLEDMM prevent overflow on buffer type uint8_t
buffer[3] = min(Segment::maxHeight, (uint16_t) 255); buffer[3] = min(Segment::maxHeight, (uint16_t) 255);
//WLEDMM: no skipLines //WLEDMM: no skipLines
} }