mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-21 10:26:06 +03:00
TCP connect and send delay fix (#6213)
* TCP connect and send delay fix Implement early exit as connection established or data already sent. (Previous implementation was exiting only on timeout expired)
This commit is contained in:
parent
403001e37c
commit
4bfa2ae889
@ -130,8 +130,11 @@ public:
|
||||
}
|
||||
_connect_pending = 1;
|
||||
_op_start_time = millis();
|
||||
// This delay will be interrupted by esp_schedule in the connect callback
|
||||
delay(_timeout_ms);
|
||||
// Following delay will be interrupted by connect callback
|
||||
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);
|
||||
}
|
||||
_connect_pending = 0;
|
||||
if (!_pcb) {
|
||||
DEBUGV(":cabrt\r\n");
|
||||
@ -456,8 +459,11 @@ protected:
|
||||
}
|
||||
|
||||
_send_waiting = true;
|
||||
// This delay will be interrupted by esp_schedule on next received ack
|
||||
delay(_timeout_ms);
|
||||
// Following delay will be interrupted by on next received ack
|
||||
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);
|
||||
}
|
||||
} while(true);
|
||||
_send_waiting = false;
|
||||
|
||||
@ -603,6 +609,7 @@ protected:
|
||||
(void) pcb;
|
||||
assert(pcb == _pcb);
|
||||
assert(_connect_pending);
|
||||
_connect_pending = 0;
|
||||
esp_schedule();
|
||||
return ERR_OK;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user