`fairness advert <hours>|clear`: each origin's flood advert is forwarded at most once per window (0 = off, max 720 h), keyed on the first 4 B of its pubkey in a 256-entry ring (2 KB RAM). Ported from DutchMeshCore's AdvertLimiter (d26421b0); runs ahead of the advert bucket, so a held advert takes no token. Motivation: companion CP1 floods an advert every 60 s since 30. 10. 2026 and still made up 18 % of the adverts our masts forwarded -- the 7-bit advert bucket cannot single it out without hurting the ~8 nodes that share its bucket. `fairness dryrun on|off`: window and buckets count every verdict but forward anyway. `fairness air`: estimated airtime shed per reason. The bucket kill switch (`fairness off`) no longer disables the window. Both new settings persist (fair_advh, fair_dry). Bench 1. 11. 2026 (x3 DUT, x1 spammer + witness, 866.5/SF8, advert every 30 s, echoes counted on the witness): dry-run 6/6 forwarded with 5 counted as held, enforced 1/6, window off 3/3, buckets in dry-run 5/5 with 3 counted; settings survive a reboot. Native tests 26/26 fairness, 119 total. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f8ea4144d9
commit
e8d5ab417a
7 files changed
+351
-11
No files matched your search
@@ -369,9 +369,14 @@ protected:
|
||||
#endif
|
||||
// CUSTOM (TeTeHacko): FairnessLimiter veto. mesh::Mesh consults this as the
|
||||
// LAST condition of every forward decision, so a token is only taken for a
|
||||
// packet that would otherwise transmit. Runtime kill switch in prefs.
|
||||
// packet that would otherwise transmit. Buckets have a runtime kill switch
|
||||
// (`fairness on|off`), the advert window its own (`fairness advert 0`).
|
||||
// What gets shed is also summed as airtime -- in dry-run, what WOULD be.
|
||||
bool takeForwardingRateLimit(const mesh::Packet* packet) override {
|
||||
return !_prefs.fairness_enabled || fairness_limiter.allowPacket(packet);
|
||||
bool ok = fairness_limiter.allowPacket(packet, _ms->getMillis());
|
||||
FairShed why = fairness_limiter.lastShed();
|
||||
if (why != FAIR_SHED_NONE) fairness_limiter.addShedAirtime(why, _radio->getEstAirtimeFor(packet->getRawLength()));
|
||||
return ok;
|
||||
}
|
||||
const char* getLogDateTime() override;
|
||||
void logRxRaw(float snr, float rssi, const uint8_t raw[], int len) override;
|
||||
|
||||
Reference in new issue
Block a user