File tree 1 file changed +6
-34
lines changed
1 file changed +6
-34
lines changed Original file line number Diff line number Diff line change @@ -309,42 +309,14 @@ void WebServer::_uploadWriteByte(uint8_t b){
309
309
_currentUpload->buf [_currentUpload->currentSize ++] = b;
310
310
}
311
311
312
- int WebServer::_uploadReadByte (WiFiClient& client){
312
+ int WebServer::_uploadReadByte (WiFiClient& client) {
313
313
int res = client.read ();
314
- if (res < 0 ) {
315
- // keep trying until you either read a valid byte or timeout
316
- unsigned long startMillis = millis ();
317
- long timeoutIntervalMillis = client.getTimeout ();
318
- boolean timedOut = false ;
319
- for (;;) {
320
- if (!client.connected ()) return -1 ;
321
- // loosely modeled after blinkWithoutDelay pattern
322
- while (!timedOut && !client.available () && client.connected ()){
323
- delay (2 );
324
- timedOut = millis () - startMillis >= timeoutIntervalMillis;
325
- }
326
314
327
- res = client.read ();
328
- if (res >= 0 ) {
329
- return res; // exit on a valid read
330
- }
331
- // NOTE: it is possible to get here and have all of the following
332
- // assertions hold true
333
- //
334
- // -- client.available() > 0
335
- // -- client.connected == true
336
- // -- res == -1
337
- //
338
- // a simple retry strategy overcomes this which is to say the
339
- // assertion is not permanent, but the reason that this works
340
- // is elusive, and possibly indicative of a more subtle underlying
341
- // issue
342
-
343
- timedOut = millis () - startMillis >= timeoutIntervalMillis;
344
- if (timedOut) {
345
- return res; // exit on a timeout
346
- }
347
- }
315
+ if (res < 0 ) {
316
+ while (!client.available () && client.connected ())
317
+ delay (2 );
318
+
319
+ res = client.read ();
348
320
}
349
321
350
322
return res;
You can’t perform that action at this time.
0 commit comments