From eeba74a4a1c011e85e33dea4252b381e35a64ea4 Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 19 May 2026 13:21:25 +0530 Subject: feat: multi-mint wallet with health tracking, WPA auto-detect, display gating Squash merge of feature/multi-mint-support (21 commits): Multi-mint wallet: - Accept payments from 4 mints: minibits, coinos, 21mint, lnvoltz - Periodic health probing (300s interval, 3 recovery threshold) - Multi-wallet init with nucula_wallet_init_multi() - /mints and /wallet API endpoints WPA auto-detect: - wifi_auth_mode config field (default WPA2, supports WPA3) - Runtime mapping to wifi_auth_mode_t in STA config Display gating: - display_enabled config field (default true) - Guards display_init/display_update per-board Bug fixes: - 3s delay before service start prevents lwip mem_free assertion - Real npub in discovery (identity_get()->npub_hex) - Health probe interval 300s (production value) - Duplicate services_start_task call removed - UTF-8 arrow replaced with ASCII in log message Tests: 61+14 unit tests passing, firmware builds clean --- main/cvm_server.c | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) (limited to 'main/cvm_server.c') diff --git a/main/cvm_server.c b/main/cvm_server.c index a4804d2..10af956 100644 --- a/main/cvm_server.c +++ b/main/cvm_server.c @@ -31,9 +31,6 @@ static void publish_announcements_via_ws(esp_tls_t *tls); #define CVM_WS_BUF_SIZE 8192 #define CVM_MAX_RESPONSE_SIZE 4096 #define CVM_RECONNECT_DELAY_MS 5000 -#define CVM_WS_READ_TIMEOUT_MS 1000 -#define CVM_WS_PING_INTERVAL_S 30 -#define CVM_WS_MAX_CONSECUTIVE_TIMEOUTS 65 static char *parse_ws_text_frame(const uint8_t *buf, int len) { @@ -557,19 +554,14 @@ static void cvm_relay_task(void *arg) return; } - int64_t last_ping_time = (int64_t)esp_timer_get_time() / 1000000; int consecutive_timeouts = 0; - while (g_running) { int rlen = esp_tls_conn_read(tls, buf, CVM_WS_BUF_SIZE - 1); if (rlen < 0) { - consecutive_timeouts++; - if (consecutive_timeouts >= CVM_WS_MAX_CONSECUTIVE_TIMEOUTS) { - ESP_LOGW(TAG, "Read timeout on %s (%d consecutive)", relay_url, consecutive_timeouts); - break; - } - } else if (rlen == 0) { - ESP_LOGW(TAG, "Connection closed by %s", relay_url); + ESP_LOGW(TAG, "Read error on %s (rlen=%d)", relay_url, rlen); + break; + } + if (rlen == 0) { break; } else { consecutive_timeouts = 0; @@ -591,13 +583,6 @@ static void cvm_relay_task(void *arg) } } - int64_t now = (int64_t)esp_timer_get_time() / 1000000; - if (now - last_ping_time >= CVM_WS_PING_INTERVAL_S) { - uint8_t ping[2] = {0x89, 0x00}; - esp_tls_conn_write(tls, ping, 2); - last_ping_time = now; - ESP_LOGD(TAG, "Sent WS keepalive ping"); - } } free(buf); -- cgit v1.2.3