fix(network): recover stale Wi-Fi after first HTTPS failure

This commit is contained in:
chenjintao
2026-08-13 09:36:44 +08:00
parent f3da3bfa93
commit 5711c26a9a
4 changed files with 13 additions and 9 deletions
@@ -111,7 +111,7 @@
#endif
#if CONFIG_TQ_NETWORK_AUTO_REASSOCIATION_ENABLE
#define CONTROL_PLANE_NETWORK_FAILURE_REASSOC_THRESHOLD 2U
#define CONTROL_PLANE_NETWORK_FAILURE_REASSOC_THRESHOLD 1U
#endif
#if !defined(CONFIG_TQ_PTT_MODE_HOLD_TO_TALK) && !defined(CONFIG_TQ_PTT_MODE_CLICK_TO_TALK)
@@ -1815,7 +1815,7 @@ static void control_plane_wifi_state_task(void *arg)
#if CONFIG_TQ_NETWORK_AUTO_REASSOCIATION_ENABLE
if (connected && control_plane_consume_wifi_reassociation_request()) {
ESP_LOGW(TAG,
"Network recovery experiment: controlled STA reassociation started after %u HTTPS connection failures",
"Network recovery: controlled STA reassociation started after %u HTTPS connection failure",
(unsigned)CONTROL_PLANE_NETWORK_FAILURE_REASSOC_THRESHOLD);
domain_runtime_behavior_set_keep_awake(true);
esp_err_t reassoc_err = domain_runtime_wifi_portal_reconnect_sta(
@@ -1823,7 +1823,7 @@ static void control_plane_wifi_state_task(void *arg)
domain_runtime_behavior_set_keep_awake(false);
connected = control_plane_is_sta_connected();
ESP_LOGW(TAG,
"Network recovery experiment: controlled STA reassociation result=%s connected=%d",
"Network recovery: controlled STA reassociation result=%s connected=%d",
esp_err_to_name(reassoc_err),
connected ? 1 : 0);
if (reassoc_err == ESP_OK && connected) {
@@ -36,7 +36,10 @@
#endif
#define PLATFORM_HTTPS_DEFAULT_TIMEOUT_MS 10000
#define PLATFORM_HTTPS_DNS_RETRY_COUNT 2
/* lwIP getaddrinfo() already performs bounded DNS retransmission internally and
* can block for roughly 14 seconds on a stale STA data path. Retrying the same
* lookup here only duplicates that delay before control-plane recovery runs. */
#define PLATFORM_HTTPS_DNS_RETRY_COUNT 1
#define PLATFORM_HTTPS_DNS_RETRY_DELAY_MS 500
#define PLATFORM_HTTPS_HOST_MAX_LEN 256
#if CONFIG_TQ_NETWORK_DIAGNOSTICS_ENABLE
+5 -4
View File
@@ -173,13 +173,14 @@ menu "Example Configuration"
config TQ_NETWORK_AUTO_REASSOCIATION_ENABLE
bool "Enable automatic Wi-Fi reassociation after HTTPS failures"
default n
default y
help
After two consecutive multimodal HTTPS connection failures,
After the first multimodal HTTPS connection failure,
disconnect and reconnect the Wi-Fi station before retrying.
This interrupts all device network traffic while reassociation
is in progress. Keep disabled unless field testing shows that
reconnecting only the multimodal transport is insufficient.
is in progress. Field testing confirmed that this recovers a
stale STA data path which remains associated but cannot reach
DNS, the gateway, or a cached HTTPS endpoint.
config TQ_SYSTEM_EVENT_ENABLE
bool "Enable control-plane system event task"
+1 -1
View File
@@ -28,7 +28,7 @@ CONFIG_TQ_MEMORY_MONITOR_INTERNAL_WARN_BYTES=16384
CONFIG_TQ_MEMORY_MONITOR_DMA_LARGEST_WARN_BYTES=4096
CONFIG_TQ_NETWORK_DIAGNOSTICS_ENABLE=y
CONFIG_TQ_MULTIMODAL_DIAGNOSTICS_ENABLE=y
# CONFIG_TQ_NETWORK_AUTO_REASSOCIATION_ENABLE is not set
CONFIG_TQ_NETWORK_AUTO_REASSOCIATION_ENABLE=y
CONFIG_TQ_SYSTEM_EVENT_ENABLE=y
CONFIG_TQ_SYSTEM_EVENT_QUEUE_LEN=32
CONFIG_TQ_SYSTEM_EVENT_TASK_STACK=4096