diff options
| author | Your Name <you@example.com> | 2026-05-19 03:18:04 +0530 |
|---|---|---|
| committer | Your Name <you@example.com> | 2026-05-19 03:18:04 +0530 |
| commit | eeb9d2d1dfd38dd19fa641e6f733c917a3d1d005 (patch) | |
| tree | 4a3e3cf14290992a87968a833d7f041c45a7bf3b /main/tollgate_main.c | |
| parent | 81f2dc52dc42d01c89dff45a5407ec40b8863052 (diff) | |
feat: CVM relay stability fix + MCP relay integration tests
Relay disconnect fix (cvm_server.c):
- TLS read timeout reduced from 15s to 1s (short poll loop)
- Ping timer fires every 30s independently of read activity
- Consecutive timeout counter (65s) detects real disconnects
- Handle relay close frames (opcode 0x08) explicitly
- Result: 120s+ stable connection (previously ~37s disconnect cycle)
MCP relay integration tests (17/17 pass via make test-cvm-mcp):
- MCP initialize roundtrip via relay.primal.net
- get_sessions returns session array
- get_usage returns metric/price/step fields
- Non-owner auth rejection (board silently drops)
- Owner control request passes after rejection test
Build fixes:
- Remove display/font/axs15231b/qrcode deps (from display branch, not here)
- Remove local_relay/relay_selector/sync_manager deps (from relay branch)
- Add esp_timer to CMakeLists REQUIRES
Host unit tests: 61/61 pass
Diffstat (limited to 'main/tollgate_main.c')
| -rw-r--r-- | main/tollgate_main.c | 12 |
1 files changed, 0 insertions, 12 deletions
diff --git a/main/tollgate_main.c b/main/tollgate_main.c index 4741765..fa7a692 100644 --- a/main/tollgate_main.c +++ b/main/tollgate_main.c | |||
| @@ -23,10 +23,6 @@ | |||
| 23 | #include "tollgate_client.h" | 23 | #include "tollgate_client.h" |
| 24 | #include "lightning_payout.h" | 24 | #include "lightning_payout.h" |
| 25 | #include "cvm_server.h" | 25 | #include "cvm_server.h" |
| 26 | #include "display.h" | ||
| 27 | #include "local_relay.h" | ||
| 28 | #include "relay_selector.h" | ||
| 29 | #include "sync_manager.h" | ||
| 30 | 26 | ||
| 31 | #define MAX_STA_RETRY 5 | 27 | #define MAX_STA_RETRY 5 |
| 32 | static const char *TAG = "tollgate_main"; | 28 | static const char *TAG = "tollgate_main"; |
| @@ -182,11 +178,6 @@ static void start_services(void) | |||
| 182 | s_services_running = true; | 178 | s_services_running = true; |
| 183 | if (s_services_mutex) xSemaphoreGive(s_services_mutex); | 179 | if (s_services_mutex) xSemaphoreGive(s_services_mutex); |
| 184 | ESP_LOGI(TAG, "=== TollGate services started ==="); | 180 | ESP_LOGI(TAG, "=== TollGate services started ==="); |
| 185 | |||
| 186 | display_set_state(DISPLAY_READY); | ||
| 187 | char portal_url[128]; | ||
| 188 | snprintf(portal_url, sizeof(portal_url), "http://%s/", cfg->ap_ip_str); | ||
| 189 | display_update(cfg->ap_ssid, 0, 0, portal_url); | ||
| 190 | } | 181 | } |
| 191 | 182 | ||
| 192 | static void stop_services(void) | 183 | static void stop_services(void) |
| @@ -270,9 +261,6 @@ void app_main(void) | |||
| 270 | { | 261 | { |
| 271 | ESP_LOGI(TAG, "=== TollGate ESP32 Starting ==="); | 262 | ESP_LOGI(TAG, "=== TollGate ESP32 Starting ==="); |
| 272 | 263 | ||
| 273 | display_init(); | ||
| 274 | display_set_state(DISPLAY_BOOT); | ||
| 275 | |||
| 276 | esp_err_t ret = nvs_flash_init(); | 264 | esp_err_t ret = nvs_flash_init(); |
| 277 | if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) { | 265 | if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) { |
| 278 | ESP_ERROR_CHECK(nvs_flash_erase()); | 266 | ESP_ERROR_CHECK(nvs_flash_erase()); |