From c80b564f4e793dafacc2d55c95bd0753229c2b64 Mon Sep 17 00:00:00 2001 From: david gauchard Date: Tue, 3 Sep 2019 23:05:23 +0200 Subject: [PATCH] ClientContext: restore two bools --- .../ESP8266WiFi/src/include/ClientContext.h | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/libraries/ESP8266WiFi/src/include/ClientContext.h b/libraries/ESP8266WiFi/src/include/ClientContext.h index 2fd3b8dca7..abbb20e81c 100644 --- a/libraries/ESP8266WiFi/src/include/ClientContext.h +++ b/libraries/ESP8266WiFi/src/include/ClientContext.h @@ -128,14 +128,14 @@ class ClientContext if (err != ERR_OK) { return 0; } - _delaying = true; + _connect_pending = true; _op_start_time = millis(); // 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) delay(1); } - _delaying = false; + _connect_pending = false; if (!_pcb) { DEBUGV(":cabrt\r\n"); return 0; @@ -432,8 +432,9 @@ class ClientContext void _notify_error() { - if (_delaying) { - _delaying = false; + if (_connect_pending || _send_waiting) { + _send_waiting = false; + _connect_pending = false; esp_schedule(); // break current delay() } } @@ -441,7 +442,7 @@ class ClientContext size_t _write_from_source(DataSource* ds) { assert(_datasource == nullptr); - assert(!_delaying); + assert(!_send_waiting); _datasource = ds; _written = 0; _op_start_time = millis(); @@ -459,13 +460,13 @@ class ClientContext break; } - _delaying = true; + _send_waiting = true; // 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) delay(1); } - _delaying = false; + _send_waiting = false; } while(true); if (_sync) @@ -533,8 +534,8 @@ class ClientContext void _write_some_from_cb() { - if (_delaying) { - _delaying = false; + if (_send_waiting) { + _send_waiting = false; esp_schedule(); // break current delay() } } @@ -609,8 +610,8 @@ class ClientContext (void) err; (void) pcb; assert(pcb == _pcb); - if (_delaying) { - _delaying = false; + if (_connect_pending) { + _connect_pending = false; esp_schedule(); // break current delay() } return ERR_OK; @@ -660,7 +661,8 @@ class ClientContext size_t _written = 0; uint32_t _timeout_ms = 5000; uint32_t _op_start_time = 0; - bool _delaying = false; + bool _send_waiting = false; + bool _connect_pending = false; int8_t _refcnt; ClientContext* _next;