1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-07 16:23:38 +03:00

Bugfix for stuck in write method of WiFiClient and WiFiClientSecure until the remote peer closed connection (#6104)

* Bugfix - write method of WiFiClient and WiFiClientSecure can stuck forever

* Adjustment of uint8_t to bool to have it clear flag
This commit is contained in:
Dave 2019-05-17 00:00:12 +02:00 committed by david gauchard
parent 2dff28abc7
commit 25c95ac185

View File

@ -437,7 +437,7 @@ protected:
size_t _write_from_source(DataSource* ds) size_t _write_from_source(DataSource* ds)
{ {
assert(_datasource == nullptr); assert(_datasource == nullptr);
assert(_send_waiting == 0); assert(!_send_waiting);
_datasource = ds; _datasource = ds;
_written = 0; _written = 0;
_op_start_time = millis(); _op_start_time = millis();
@ -455,10 +455,10 @@ protected:
break; break;
} }
++_send_waiting; _send_waiting = true;
esp_yield(); esp_yield();
} while(true); } while(true);
_send_waiting = 0; _send_waiting = false;
if (_sync) if (_sync)
wait_until_sent(); wait_until_sent();
@ -525,8 +525,8 @@ protected:
void _write_some_from_cb() void _write_some_from_cb()
{ {
if (_send_waiting == 1) { if (_send_waiting) {
_send_waiting--; _send_waiting = false;
esp_schedule(); esp_schedule();
} }
} }
@ -650,7 +650,7 @@ private:
size_t _written = 0; size_t _written = 0;
uint32_t _timeout_ms = 5000; uint32_t _timeout_ms = 5000;
uint32_t _op_start_time = 0; uint32_t _op_start_time = 0;
uint8_t _send_waiting = 0; bool _send_waiting = false;
uint8_t _connect_pending = 0; uint8_t _connect_pending = 0;
int8_t _refcnt; int8_t _refcnt;