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;
|
_connect_pending = 1;
|
||||||
_op_start_time = millis();
|
_op_start_time = millis();
|
||||||
// This delay will be interrupted by esp_schedule in the connect callback
|
// Following delay will be interrupted by connect callback
|
||||||
delay(_timeout_ms);
|
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;
|
_connect_pending = 0;
|
||||||
if (!_pcb) {
|
if (!_pcb) {
|
||||||
DEBUGV(":cabrt\r\n");
|
DEBUGV(":cabrt\r\n");
|
||||||
@ -456,8 +459,11 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
_send_waiting = true;
|
_send_waiting = true;
|
||||||
// This delay will be interrupted by esp_schedule on next received ack
|
// Following delay will be interrupted by on next received ack
|
||||||
delay(_timeout_ms);
|
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);
|
} while(true);
|
||||||
_send_waiting = false;
|
_send_waiting = false;
|
||||||
|
|
||||||
@ -603,6 +609,7 @@ protected:
|
|||||||
(void) pcb;
|
(void) pcb;
|
||||||
assert(pcb == _pcb);
|
assert(pcb == _pcb);
|
||||||
assert(_connect_pending);
|
assert(_connect_pending);
|
||||||
|
_connect_pending = 0;
|
||||||
esp_schedule();
|
esp_schedule();
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user