mirror of
https://github.com/esphome/esphome.git
synced 2026-10-14 02:02:51 +00:00
Probe UDP for 15 s before falling back to TCP
A device whose radio is busy with BLE can miss every probe for 5 s and lose UDP. The device's commit wait grows to 80 s to cover the 60 s token wait plus the longer probe.
This commit is contained in:
@@ -36,8 +36,8 @@ static constexpr uint8_t UDP_FLAG_COMMITTED = 0x80;
|
||||
static constexpr uint8_t UDP_MSG_ACK = 0x40;
|
||||
static constexpr size_t UDP_HEADER_SIZE = 9;
|
||||
static constexpr size_t UDP_ACK_HEADER_SIZE = 12;
|
||||
// The client's 60 s wait for the token over a lossy TCP link, plus its 5 s probe
|
||||
static constexpr uint32_t UDP_COMMIT_TIMEOUT = 70000;
|
||||
// The client's 60 s wait for the token over a lossy TCP link, plus its 15 s probe
|
||||
static constexpr uint32_t UDP_COMMIT_TIMEOUT = 80000;
|
||||
// Like the TCP socket's SO_RCVTIMEO in handle_data_, so readall_ treats both alike
|
||||
static constexpr uint32_t UDP_READ_WAIT_MS = 2000;
|
||||
// How often the commit wait looks at the UDP link between reads of the TCP fallback byte
|
||||
|
||||
+3
-2
@@ -133,8 +133,9 @@ UDP_MAX_PAYLOAD = 1400
|
||||
# Messages the device queues unconsumed (UDP_WINDOW in ota_esphome.h); as many
|
||||
# as TCP's window holds, so UDP costs the device no more memory than TCP
|
||||
UDP_WINDOW = 4
|
||||
# Probe this long before falling back to TCP; the device waits 70 s
|
||||
UDP_PROBE_TIMEOUT = 5.0
|
||||
# Probe this long before falling back to TCP, enough to ride out a radio busy
|
||||
# with BLE; the device waits 80 s
|
||||
UDP_PROBE_TIMEOUT = 15.0
|
||||
UDP_PROBE_INTERVAL = 0.1
|
||||
# Resend timeout bounds around srtt + 4 * rttvar; random loss never grows it
|
||||
UDP_RESEND_INITIAL = 0.5
|
||||
|
||||
Reference in New Issue
Block a user