mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-07 16:23:38 +03:00
ClientContext: restore use of two different pending booleans for connect and write #6483
This commit is contained in:
parent
07d8128b96
commit
291b321e62
@ -128,14 +128,14 @@ public:
|
|||||||
if (err != ERR_OK) {
|
if (err != ERR_OK) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
_delaying = true;
|
_connect_pending = true;
|
||||||
_op_start_time = millis();
|
_op_start_time = millis();
|
||||||
// Following delay will be interrupted by connect callback
|
// Following delay will be interrupted by connect callback
|
||||||
for (decltype(_timeout_ms) i = 0; _delaying && i < _timeout_ms; i++) {
|
for (decltype(_timeout_ms) i = 0; _connect_pending && i < _timeout_ms; i++) {
|
||||||
// Give scheduled functions a chance to run (e.g. Ethernet uses recurrent)
|
// Give scheduled functions a chance to run (e.g. Ethernet uses recurrent)
|
||||||
delay(1);
|
delay(1);
|
||||||
}
|
}
|
||||||
_delaying = false;
|
_connect_pending = false;
|
||||||
if (!_pcb) {
|
if (!_pcb) {
|
||||||
DEBUGV(":cabrt\r\n");
|
DEBUGV(":cabrt\r\n");
|
||||||
return 0;
|
return 0;
|
||||||
@ -432,8 +432,9 @@ protected:
|
|||||||
|
|
||||||
void _notify_error()
|
void _notify_error()
|
||||||
{
|
{
|
||||||
if (_delaying) {
|
if (_connect_pending || _send_waiting) {
|
||||||
_delaying = false;
|
_send_waiting = false;
|
||||||
|
_connect_pending = false;
|
||||||
esp_schedule(); // break current delay()
|
esp_schedule(); // break current delay()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -441,7 +442,7 @@ protected:
|
|||||||
size_t _write_from_source(DataSource* ds)
|
size_t _write_from_source(DataSource* ds)
|
||||||
{
|
{
|
||||||
assert(_datasource == nullptr);
|
assert(_datasource == nullptr);
|
||||||
assert(!_delaying);
|
assert(!_send_waiting);
|
||||||
_datasource = ds;
|
_datasource = ds;
|
||||||
_written = 0;
|
_written = 0;
|
||||||
_op_start_time = millis();
|
_op_start_time = millis();
|
||||||
@ -459,13 +460,13 @@ protected:
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
_delaying = true;
|
_send_waiting = true;
|
||||||
// Following delay will be interrupted by on next received ack
|
// Following delay will be interrupted by on next received ack
|
||||||
for (decltype(_timeout_ms) i = 0; _delaying && i < _timeout_ms; i++) {
|
for (decltype(_timeout_ms) i = 0; _send_waiting && i < _timeout_ms; i++) {
|
||||||
// Give scheduled functions a chance to run (e.g. Ethernet uses recurrent)
|
// Give scheduled functions a chance to run (e.g. Ethernet uses recurrent)
|
||||||
delay(1);
|
delay(1);
|
||||||
}
|
}
|
||||||
_delaying = false;
|
_send_waiting = false;
|
||||||
} while(true);
|
} while(true);
|
||||||
|
|
||||||
if (_sync)
|
if (_sync)
|
||||||
@ -533,8 +534,8 @@ protected:
|
|||||||
|
|
||||||
void _write_some_from_cb()
|
void _write_some_from_cb()
|
||||||
{
|
{
|
||||||
if (_delaying) {
|
if (_send_waiting) {
|
||||||
_delaying = false;
|
_send_waiting = false;
|
||||||
esp_schedule(); // break current delay()
|
esp_schedule(); // break current delay()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -609,8 +610,8 @@ protected:
|
|||||||
(void) err;
|
(void) err;
|
||||||
(void) pcb;
|
(void) pcb;
|
||||||
assert(pcb == _pcb);
|
assert(pcb == _pcb);
|
||||||
if (_delaying) {
|
if (_connect_pending) {
|
||||||
_delaying = false;
|
_connect_pending = false;
|
||||||
esp_schedule(); // break current delay()
|
esp_schedule(); // break current delay()
|
||||||
}
|
}
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
@ -660,7 +661,8 @@ 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;
|
||||||
bool _delaying = false;
|
bool _send_waiting = false;
|
||||||
|
bool _connect_pending = false;
|
||||||
|
|
||||||
int8_t _refcnt;
|
int8_t _refcnt;
|
||||||
ClientContext* _next;
|
ClientContext* _next;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user