8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1058e89 commit 8fb8478Copy full SHA for 8fb8478
libraries/WiFi/src/WiFiClient.cpp
@@ -255,6 +255,7 @@ int WiFiClient::available()
255
// Though flushing means to send all pending data,
256
// seems that in Arduino it also means to clear RX
257
void WiFiClient::flush() {
258
+ int res;
259
size_t a = available(), toRead = 0;
260
if(!a){
261
return;//nothing to flush
@@ -265,12 +266,13 @@ void WiFiClient::flush() {
265
266
}
267
while(a){
268
toRead = (a>WIFI_CLIENT_FLUSH_BUFFER_SIZE)?WIFI_CLIENT_FLUSH_BUFFER_SIZE:a;
- if(recv(fd(), buf, toRead, MSG_DONTWAIT) < 0) {
269
+ res = recv(fd(), buf, toRead, MSG_DONTWAIT);
270
+ if(res < 0) {
271
log_e("%d", errno);
272
stop();
273
break;
274
- a = available();
275
+ a -= res;
276
277
free(buf);
278
0 commit comments