1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-13 23:33:48 +01:00

[ota] Increase handshake timeout to 20s now that auth is non-blocking (#11186)

This commit is contained in:
J. Nick Koston
2025-10-12 08:27:43 -10:00
committed by GitHub
parent 9b6e8b4b41
commit 6bc9ed0810
3 changed files with 3 additions and 3 deletions

View File

@@ -29,7 +29,7 @@ namespace esphome {
static const char *const TAG = "esphome.ota"; static const char *const TAG = "esphome.ota";
static constexpr uint16_t OTA_BLOCK_SIZE = 8192; static constexpr uint16_t OTA_BLOCK_SIZE = 8192;
static constexpr size_t OTA_BUFFER_SIZE = 1024; // buffer size for OTA data transfer static constexpr size_t OTA_BUFFER_SIZE = 1024; // buffer size for OTA data transfer
static constexpr uint32_t OTA_SOCKET_TIMEOUT_HANDSHAKE = 10000; // milliseconds for initial handshake static constexpr uint32_t OTA_SOCKET_TIMEOUT_HANDSHAKE = 20000; // milliseconds for initial handshake
static constexpr uint32_t OTA_SOCKET_TIMEOUT_DATA = 90000; // milliseconds for data transfer static constexpr uint32_t OTA_SOCKET_TIMEOUT_DATA = 90000; // milliseconds for data transfer
#ifdef USE_OTA_PASSWORD #ifdef USE_OTA_PASSWORD

View File

@@ -410,7 +410,7 @@ def run_ota_impl_(
af, socktype, _, _, sa = r af, socktype, _, _, sa = r
_LOGGER.info("Connecting to %s port %s...", sa[0], sa[1]) _LOGGER.info("Connecting to %s port %s...", sa[0], sa[1])
sock = socket.socket(af, socktype) sock = socket.socket(af, socktype)
sock.settimeout(10.0) sock.settimeout(20.0)
try: try:
sock.connect(sa) sock.connect(sa)
except OSError as err: except OSError as err:

View File

@@ -493,7 +493,7 @@ def test_run_ota_impl_successful(
assert result_host == "192.168.1.100" assert result_host == "192.168.1.100"
# Verify socket was configured correctly # Verify socket was configured correctly
mock_socket.settimeout.assert_called_with(10.0) mock_socket.settimeout.assert_called_with(20.0)
mock_socket.connect.assert_called_once_with(("192.168.1.100", 3232)) mock_socket.connect.assert_called_once_with(("192.168.1.100", 3232))
mock_socket.close.assert_called_once() mock_socket.close.assert_called_once()