mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-07 16:23:38 +03:00
WiFiClient: apply write timeout to single chunk (#3273)
WiFiClient write timeouts introduced in #3257 applied to the whole write operation, which could take long time if data size was large. This change makes the timeout happen per chunk. Timeout now happens if no data has been delivered within a given interval.
This commit is contained in:
parent
f6d232f1ac
commit
d6f1f0d5d7
@ -353,9 +353,14 @@ protected:
|
|||||||
_written = 0;
|
_written = 0;
|
||||||
_op_start_time = millis();
|
_op_start_time = millis();
|
||||||
do {
|
do {
|
||||||
_write_some();
|
if (_write_some()) {
|
||||||
|
_op_start_time = millis();
|
||||||
|
}
|
||||||
|
|
||||||
if (!_datasource->available() || _is_timeout() || state() == CLOSED) {
|
if (!_datasource->available() || _is_timeout() || state() == CLOSED) {
|
||||||
|
if (_is_timeout()) {
|
||||||
|
DEBUGV(":wtmo\r\n");
|
||||||
|
}
|
||||||
delete _datasource;
|
delete _datasource;
|
||||||
_datasource = nullptr;
|
_datasource = nullptr;
|
||||||
break;
|
break;
|
||||||
@ -368,10 +373,10 @@ protected:
|
|||||||
return _written;
|
return _written;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _write_some()
|
bool _write_some()
|
||||||
{
|
{
|
||||||
if (!_datasource || !_pcb) {
|
if (!_datasource || !_pcb) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t left = _datasource->available();
|
size_t left = _datasource->available();
|
||||||
@ -403,7 +408,9 @@ protected:
|
|||||||
}
|
}
|
||||||
if( need_output ) {
|
if( need_output ) {
|
||||||
tcp_output(_pcb);
|
tcp_output(_pcb);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _write_some_from_cb()
|
void _write_some_from_cb()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user