Fix TCP announce flood: adaptive filter, TCP backpressure, aligned table caps

- Enhanced announce filter: adaptive rate (3/sec boot, 5/sec normal),
  skip re-validation of known paths unless hop count improved or 5min
  revalidation window expired
- Skip TCP reads when RNS loop exceeds 200ms to prevent UI starvation
- Lower MAX_ANNOUNCES_PER_SEC from 8 to 5
- Align build flag table caps (256/128) with runtime values
This commit is contained in:
DeFiDude
2026-03-19 15:24:31 -06:00
parent 00d04284c1
commit 45df807424
4 changed files with 50 additions and 19 deletions
+13 -7
View File
@@ -895,12 +895,15 @@ void loop() {
}
// 4. Reticulum loop (radio RX via LoRaInterface) — throttle to ~100Hz
unsigned long rnsDuration = 0;
{
static unsigned long lastRNS = 0;
unsigned long now = millis();
if (now - lastRNS >= 10) {
lastRNS = now;
unsigned long rnsStart = millis();
rns.loop();
rnsDuration = millis() - rnsStart;
}
}
@@ -973,14 +976,17 @@ void loop() {
}
}
// 8. WiFi + TCP loops (with global budget)
if (wifiImpl) wifiImpl->loop();
// 8. WiFi + TCP loops (with global budget) — skip if RNS was overloaded
{
unsigned long tcpBudgetStart = millis();
for (auto* tcp : tcpClients) {
if (millis() - tcpBudgetStart >= TCP_GLOBAL_BUDGET_MS) break;
tcp->loop();
yield();
bool skipTcp = (rnsDuration > 200);
if (!skipTcp && wifiImpl) wifiImpl->loop();
if (!skipTcp) {
unsigned long tcpBudgetStart = millis();
for (auto* tcp : tcpClients) {
if (millis() - tcpBudgetStart >= TCP_GLOBAL_BUDGET_MS) break;
tcp->loop();
yield();
}
}
}