mirror of
https://github.com/ratspeak/ratdeck.git
synced 2026-07-20 02:30:54 +00:00
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:
+13
-7
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user