From 02e31b4001892535602bb0c0cc9b42e14d0c4901 Mon Sep 17 00:00:00 2001 From: Me No Dev Date: Fri, 15 Sep 2023 16:13:44 +0300 Subject: [PATCH 1/2] Add 2.0.13 to issue report template --- .github/ISSUE_TEMPLATE/Issue-report.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/ISSUE_TEMPLATE/Issue-report.yml b/.github/ISSUE_TEMPLATE/Issue-report.yml index 3628cba1fca..7e9a8aea4a2 100644 --- a/.github/ISSUE_TEMPLATE/Issue-report.yml +++ b/.github/ISSUE_TEMPLATE/Issue-report.yml @@ -41,6 +41,8 @@ body: options: - latest master (checkout manually) - latest development Release Candidate (RC-X) + - v2.0.13 + - v2.0.12 - v2.0.11 - v2.0.10 - v2.0.9 From 42822d57ff8d8904990a93fc8529c6b332f42ab8 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 3 Oct 2023 14:53:00 +0200 Subject: [PATCH 2/2] Revert "Reimplemented flush in WiFiClient" --- libraries/WiFi/src/WiFiClient.cpp | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/libraries/WiFi/src/WiFiClient.cpp b/libraries/WiFi/src/WiFiClient.cpp index 85c348327dc..9e2a85f5dea 100644 --- a/libraries/WiFi/src/WiFiClient.cpp +++ b/libraries/WiFi/src/WiFiClient.cpp @@ -153,13 +153,6 @@ class WiFiClientRxBuffer { size_t available(){ return _fill - _pos + r_available(); } - - void flush(){ - if(r_available()){ - fillBuffer(); - } - _pos = _fill; - } }; class WiFiClientSocketHandle { @@ -508,7 +501,26 @@ int WiFiClient::available() // Though flushing means to send all pending data, // seems that in Arduino it also means to clear RX void WiFiClient::flush() { - _rxBuffer->flush(); + int res; + size_t a = available(), toRead = 0; + if(!a){ + return;//nothing to flush + } + uint8_t * buf = (uint8_t *)malloc(WIFI_CLIENT_FLUSH_BUFFER_SIZE); + if(!buf){ + return;//memory error + } + while(a){ + toRead = (a>WIFI_CLIENT_FLUSH_BUFFER_SIZE)?WIFI_CLIENT_FLUSH_BUFFER_SIZE:a; + res = recv(fd(), buf, toRead, MSG_DONTWAIT); + if(res < 0) { + log_e("fail on fd %d, errno: %d, \"%s\"", fd(), errno, strerror(errno)); + stop(); + break; + } + a -= res; + } + free(buf); } uint8_t WiFiClient::connected()