DeterministicESPAsyncWebServer v6.28.0
Zero-allocation, bounded-execution async HTTP server for ESP32
Loading...
Searching...
No Matches
mdns_adaptive.h File Reference

Adaptive mDNS beacon scheduling: RF-aware backoff, TTL refresher, auto-sleep beacon (DETWS_ENABLE_MDNS_ADAPTIVE). More...

#include "ServerConfig.h"
#include <stddef.h>
#include <stdint.h>

Go to the source code of this file.

Detailed Description

Adaptive mDNS beacon scheduling: RF-aware backoff, TTL refresher, auto-sleep beacon (DETWS_ENABLE_MDNS_ADAPTIVE).

The mDNS service (shipped) announces records with a TTL; caches on the network evict a record when its TTL lapses, so a device must re-announce to stay discoverable. Two pressures shape when to announce:

  • Crowded RF: on a busy 2.4 GHz channel, hammering announces just adds collisions. So back the announce interval off (toward a ceiling) when contention is high, and recover it toward the nominal cadence when the air is quiet.
  • A continuous refresher: re-announce at ~half the record TTL (RFC 6762 cache eviction is at TTL) so caches never lapse in steady state.
  • Auto-sleep beacons: before entering a sleep window that would run past the next refresh, announce now so the record survives the sleep instead of lapsing while the radio is off.

These are the pure scheduling decisions - what interval, and is an announce due (incl. before a sleep). The app owns the actual mDNS transmit. Wrap-safe time math, no heap, no stdlib, host-testable.

Definition in file mdns_adaptive.h.