From 9f34ab14ab5ec73e22e3aa88e8e4e1c6c94d7059 Mon Sep 17 00:00:00 2001 From: Justin Chow Date: Tue, 6 Jan 2026 17:08:09 -0500 Subject: [PATCH] actually update leader + increase rip ttl stack size - tcp shutdown crash occurs --- components/dataLink/DataLinkRIP.cpp | 2 +- components/rpc/CommunicationRouter.cpp | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/components/dataLink/DataLinkRIP.cpp b/components/dataLink/DataLinkRIP.cpp index 281c6a1..c0e5584 100644 --- a/components/dataLink/DataLinkRIP.cpp +++ b/components/dataLink/DataLinkRIP.cpp @@ -471,5 +471,5 @@ void DataLinkManager::start_rip_tasks(){ ESP_LOGI(DEBUG_LINK_TAG, "Starting RIP Broadcast task"); xTaskCreate(DataLinkManager::rip_broadcast_timer_function, "RIPBroadcast", 4096, static_cast(this), 5, &rip_broadcast_task); ESP_LOGI(DEBUG_LINK_TAG, "Starting RIP TTL task"); - xTaskCreate(DataLinkManager::rip_ttl_decrement_task, "RIPTTL", 2048, static_cast(this), 5, &rip_ttl_task); + xTaskCreate(DataLinkManager::rip_ttl_decrement_task, "RIPTTL", 4096, static_cast(this), 5, &rip_ttl_task); } \ No newline at end of file diff --git a/components/rpc/CommunicationRouter.cpp b/components/rpc/CommunicationRouter.cpp index 8c21838..eb061d3 100644 --- a/components/rpc/CommunicationRouter.cpp +++ b/components/rpc/CommunicationRouter.cpp @@ -34,6 +34,13 @@ CommunicationRouter::~CommunicationRouter() { vTaskDelete(m_router_thread); } const auto that = static_cast(args); while (true) { + + if (std::chrono::system_clock::now() - that->m_last_leader_updated > std::chrono::seconds(15)) { + that->m_last_leader_updated = std::chrono::system_clock::now(); + ESP_LOGI(TAG, "Updating leader"); + that->update_leader(); + } + for (uint8_t channel = 0; channel < MODULE_TO_NUM_CHANNELS_MAP[that->m_config_manager.get_module_type()]; @@ -50,7 +57,7 @@ CommunicationRouter::~CommunicationRouter() { vTaskDelete(m_router_thread); } data.resize(frame_size); that->m_data_link_manager->async_receive(data.data(), frame_size, &frame_header, channel); - that->route(data.data(), frame_size); + that->route(data.data(), frame_size); } vTaskDelay(pdMS_TO_TICKS(50));