Fix WiFiClientFixed

This commit is contained in:
Laura Hausmann 2023-02-08 23:51:03 +01:00
parent ddc337ef9c
commit 597158a038
Signed by: zotan
GPG key ID: D044E84C5BE01605

View file

@ -6,7 +6,7 @@
void WiFiClientFixed::flush() {
int res;
size_t a = available();
size_t a = available(), toRead = 0;
if (!a) {
return;//nothing to flush
}
@ -17,7 +17,8 @@ void WiFiClientFixed::flush() {
while (a) {
// override broken WiFiClient flush method, ref https://github.com/espressif/arduino-esp32/issues/6129#issuecomment-1237417915
//res = recv(fd(), buf, toRead, MSG_DONTWAIT);
res = read(buf, a);
Serial.println(a);
res = read(buf, min(a, (size_t)WIFI_CLIENT_FLUSH_BUFFER_SIZE));
if (res < 0) {
log_e("fail on fd %d, errno: %d, \"%s\"", fd(), errno, strerror(errno));
stop();